I can't seem to find the equivalent of Apache's ProxyPreserveHost http://httpd.apache.org/docs/2.0/mod/mod%5Fproxy.html#proxypreservehost option in nginx. This is required to reverse proxy to virtual hosts.

What it does is replace the host name the browser provides with the host name of the downstream server.

Does it exist?

link|improve this question
feedback

1 Answer

I think I found a solution to the problem. Sending the downstream server's host is the default behavior in nginx, and I had overridden it by using the command:

proxy_set_header Host $host;

Which sends the host requested by the browser to the downstream server. Exactly the opposite of what I wanted.

So while nginx doesn't have an equivalent to Apache's ProxyPreserveHost, the same behavior can be achieved with the proxy_set_header command, and nginx's solution is more general.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown