# Upstream for load balance

**URL:** <https://www.ruby-forum.com/t/upstream-for-load-balance/198807>\
**Category:** NGINX\
**Created:** [November 8, 2010, 11:12am UTC](https://www.ruby-forum.com/t/upstream-for-load-balance/198807 "2010-11-08T11:12:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![okkezSS](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/85f322/32.png) [@okkezSS](https://www.ruby-forum.com/u/okkezSS)\
**Post date:** [November 8, 2010, 11:12am UTC](https://www.ruby-forum.com/t/upstream-for-load-balance/198807/1 "2010-11-08T11:12:08Z")

</div>

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=efgh[http://backend\_pool/?params=abcd&token=efgh](http://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!

---

<div class="post-metadata">

**Author:** ![Abioy\_S](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/71e660/32.png) [@Abioy\_S](https://www.ruby-forum.com/u/Abioy_S)\
**Post date:** [November 8, 2010, 12:38pm UTC](https://www.ruby-forum.com/t/upstream-for-load-balance/198807/2 "2010-11-08T12:38:52Z")

</div>

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?

[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com · GitHub](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

> **[GitHub - nginxinc/nginx-wiki: ARCHIVED -- Source for the now archived NGINX Wiki...](https://github.com/nginxinc/nginx-wiki)**
>
> ARCHIVED -- Source for the now archived NGINX Wiki section of https://www.nginx.com

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. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
