Nginx configuration leads to endless redirect loop

前端 未结 9 1371
独厮守ぢ
独厮守ぢ 2020-12-01 04:18

So I\'ve looked at every sample configuration I could find and yet every time I try and view a page that requires ssl, I end up in an redirect loop. I\'m running nginx/0.8.5

相关标签:
9条回答
  • 2020-12-01 05:16

    X_FORWARDED_PROTO as in your file can cause errors and it did in my case. X-Forwarded-Proto is correct whereas the hiphens are more important than uppercase or lowercase letters.

    You can avoid those problems by sticking to conventions ;)

    see also here: Custom HTTP headers : naming conventions and here: http://www.ietf.org/rfc/rfc2047.txt

    0 讨论(0)
  • 2020-12-01 05:19

    I found that it was this line

     proxy_set_header  Host $http_host;
    

    Which should be changed to

     proxy_set_header  Host $host;
    

    According to the nginx documentation by using '$http_host you're passing the "unchanged request-header".

    0 讨论(0)
  • 2020-12-01 05:22

    Have you tried using "X-Forwarded-Proto" instead of X_FORWARDED_PROTO?

    I've run into a problem with this header before, it wasn't causing redirects, but changing this header fixed it for me.

    0 讨论(0)
提交回复
热议问题