Why proxy_set_header Host $ host; no longer works in nginx 1.8.0?

I used proxy_set_header Host $host; to set the host header to the original request node. In nginx 1.4.1, this worked fine. Now, after upgrading to 1.8.0, I get the local IP address instead of the host transmitted by the browser.

Why did this happen and how to fix it?

+9
proxy nginx
Jul 17 '15 at 18:53
source share
2 answers

TL; dg; I'm not sure when it changed, but newer versions of nginx are instead of ssl_protocols ...; - your conf should be:

proxy_ssl_server_name on; proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

Source: stack overflow

===

If you were like me, you didn’t read the log files correctly and saw host=example.com . Instead of being the host sent to the beginning, this apparently means the virtual host host-as-defined-in-nginx-conf ie

(The inclusion of error_log debug; showed that the host header was set correctly.)

The log file should also contain an error, for example, "sslv3 alert failure failed."

0
Feb 12 '18 at 23:40
source share
— -

Use proxy_set_header Host $http_host .

If proxy_set_header Host $host; doesn't work anymore, maybe the value / behavior of $host has changed. $http_host simply passes what was sent by the browser.

0
Aug 04 '19 at 21:23
source share



All Articles