Welcome! Log In Create A New Profile

Advanced

Re: upstream for load balance

Francis Daly
November 08, 2010 06:44AM
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@daoine.org

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

upstream for load balance

Abioy Sun November 08, 2010 05:14AM

Re: upstream for load balance

Francis Daly November 08, 2010 06:44AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 173
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready