Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there option to redirect http traffic to https in aws network load balancer

In Classic Load Balancer(CLB) and Application Load Balancer(ALB) there is option to redirect all http traffic to https listener.

I do not find the option to redirect tcp port 80 traffic to tls port 443 from NLB (Network Load Balancer)

Any help is much appreciated.

like image 239
jaleel Avatar asked Jul 03 '20 18:07

jaleel


2 Answers

No, You can not redirect to HTTP/HTTPS as Network LB does not have application layer.

HTTP and HTTPS traffic can be routed to your environment over TCP. To establish secure HTTPS connections between web clients and your environment, install a self-signed certificate on the environment's instances, and configure the instances to listen on the appropriate port (typically 443) and terminate HTTPS connections.

environments-cfg-nlb

like image 200
Adiii Avatar answered Oct 18 '22 15:10

Adiii


AWS Network Load Balancer cannot handle layer 7 thus cannot redirect HTTP to HTTPS by itself.

Workaround I did is:

  1. forward HTTPS requests to app servers' HTTP
  2. forward HTTP requests to app server's port 8080
  3. set up one app server to listen to port 8080, and redirect requests to https:

In this way, the network load balancer can still terminate TLS. And if HTTP requests come to the LB, it will forward to port 8080 and the app/web server will redirect it to your https site.

like image 37
mask8 Avatar answered Oct 18 '22 14:10

mask8