upstream for load balance

Francis Daly francis at daoine.org
Mon Nov 8 14:37:41 MSK 2010


On Mon, Nov 08, 2010 at 06:04:32PM +0800, Abioy Sun wrote:

Hi there,

> location / {
>  ... ...
>  proxy_pass http://backend_pool;
> }

> I try to dig out what happens via access log and found that the $host
> parameter in access log of backend host turn out to be "backend_pool".
> 
> Is it a bug or a design for some certain purpose? How could I got the
> correct host?

http://wiki.nginx.org/HttpProxyModule#proxy_pass says, among other things,

"""
Note that the HTTP Host header is not forwarded, but is set based on
the proxy_pass statement.
"""

That agrees with the "default" value of proxy_set_header, as per
http://wiki.nginx.org/HttpProxyModule#proxy_set_header

Possibly you want to use something like

proxy_set_header Host $host;

near your proxy_pass line above.

Alternatively, if you know what the host name you want to use is, you
can just use it directly.

Good luck,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list