1

I have this configuration:

  • The Amazon Elastic Load Balancer (ELB) routes port 80 to port 81 and port 443 to port 80
    • The cert is handled in ELB
  • Nginx listens to port 80 and 81
    • Port 81 redirects to https
    • Port 80 is the main server

The nginx server block for port 81:

server { listen 81 default_server; listen [::]:81 default_server; server_name _; return 301 https://$host$request_uri; } 

The problem is that http requests timeout (408). Suggestions?

5
  • Always? Occasionally? Commented Dec 2, 2016 at 13:08
  • Always - doesn't seem to be listening to port 81. Commented Dec 4, 2016 at 7:30
  • Well, you do need port 81 open in the security group on the instance... but error 408 Request Timeout means the server timed out waiting for the client. 504 Gateway Timeout would be the opposite error, and more sensible if this were the problem. Can you capture the response headers? Commented Dec 4, 2016 at 12:27
  • 1
    Simpler solution: port 80 listener issues the redirect if $http_x_forwarded_proto isn't set to the string https, because ELB will set that for each request if the client connection uses HTTPS. Commented Dec 4, 2016 at 12:30
  • @Michael-sqlbot - Thanks - that's the workaround I ended up using. Commented Dec 5, 2016 at 5:51

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.