Reputation: 2529
I have web servers running nginx behind a AWS ELB. I have setup the ELB to accept https connections, and send the requests over http to the webservers. I would also like to accept http connection to the ELB, and redirect them to https.
All solutions to this redirection problem involve handling https on the webserver and redirecting it to http.
Is there a way to do this without handling the redirect on the webserver? I would rather not have to have my ssl certificate on the ELB and all webservers.
Upvotes: 1
Views: 445
Reputation: 24573
Yes, this is very common. It'll depend on what your webserver is, but you look for the X-Forwarded-Proto
header. If it's set to http
, redirect the user.
Here's Amazon's documentation on the X-Forwarded-* headers, and here's a blog entry talking about one way to implement the forward in nginx.
Upvotes: 2