I used proxy_set_header Host $host;
to set the host header to the original request host. In nginx 1.4.1 this was working fine. Now after upgrading to 1.8.0, I'm getting the local IP instead of the host passed by the browser.
Why did this happen and how do I fix it?
To adjust or set headers for proxied connections, use the proxy_set_header directive, followed by the header value. You can find a list of all available Request Headers and their allowed values here . If you want to prevent a header from being passed to the proxied server, set it to an empty string "" .
The proxy_pass setting makes the Nginx reverse proxy setup work. The proxy_pass is configured in the location section of any virtual host configuration file. To set up an Nginx proxy_pass globally, edit the default file in Nginx's sites-available folder.
Use proxy_set_header Host $http_host
.
If proxy_set_header Host $host;
no longer works, perhaps the meaning/ behavior of $host
changed. $http_host
just passes along what was sent by the browser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With