Welcome! Log In Create A New Profile

Advanced

Re: How to redirect to https when using load balancer in front of nginx

September 04, 2019 09:32PM
In order to redirect http to https, you have to define a listener rule in the ALB that redirects all traffic on port 80 to port 443 (of the ALB) with the original path and query parameters. The status code should be a 301 (permanent redirection). That's the context between the client and the ALB.

The certificate for the domain(s) will be installed in the ALB.

The target group for the ALB would contain the http target (or be filled in by an auto-scaling group's members in case you have multiple targets from an auto-scaling group). Your application server would only see http requests coming from the ALB. You won't get any https requests.

The important point about rewriting http requests (from the client perspective) to https requests (client perspective again) is to define that rule in the ALB, and make that rule redirect requests for all paths.

On the other hand, why do you need the ALB if you have an NGINX in there, anyway? I would rather settle for a simple NLB and handle http/https redirections etc. in the NGINX itself.

Cheers,
--j.
Subject Author Posted

How to redirect to https when using load balancer in front of nginx

Palvelin Postmaster September 04, 2019 05:16PM

Re: How to redirect to https when using load balancer in front of nginx

j94305 September 04, 2019 09:32PM

Re: How to redirect to https when using load balancer in front of nginx

Palvelin Postmaster September 05, 2019 03:56PM

Re: How to redirect to https when using load balancer in front of nginx

Palvelin Postmaster September 06, 2019 03:14PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 272
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready