Upstream for load balance

hi all,

I use nginx for load balance with the following configuration.

------------------------- configuration -------------------------
… …
upstream backend_pool {
server 192.168.1.2:8899;
server 192.168.1.3:8898;
server 192.168.1.4:8897;
}
… …
location / {
… …
proxy_pass http://backend_pool;
}
------------------------- configuration -------------------------

The backend services require single sign-on on another host M, and
jumping
back after SSO. But when I use the fastcgi parameter $host in the jump
back
url, I get the string “backend_pool” and the jump back url turns out to
be
something like
“http://backend_pool?params=abcd&token=efghhttp://backend_pool/?params=abcd&token=efgh”.
Clients
can not recognize the host “backend_pool”, so the connection fails.

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?

thx!

On Mon, Nov 08, 2010 at 06:04:32PM +0800, Abioy S. 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?

Module ngx_http_proxy_module 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 D. [email protected]