How to redirect to https when using load balancer in front of nginx
Palvelin Postmaster
postmaster at palvelin.fi
Thu Sep 5 19:55:38 UTC 2019
> On 4 Sep 2019, at 18.32, j94305 <nginx-forum at forum.nginx.org> wrote:
>
> 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.
Yes, I believe this I have setup in ALB, as I tried to explain (poorly, maybe):
alb-my-server-com | HTTP:80
(1 rule)
Redirect to: https://#{host}:443/#{path}?#{query}
Status code: HTTP_301
The issue I outlined happens with nginx regardless.
More information about the nginx
mailing list