# Issue with upstream hash

**URL:** <https://www.ruby-forum.com/t/issue-with-upstream-hash/190203>\
**Category:** NGINX\
**Created:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/issue-with-upstream-hash/190203 "2010-06-17T16:22:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Wuvist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/c89c15/32.png) [@Wuvist](https://www.ruby-forum.com/u/Wuvist)\
**Post date:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/issue-with-upstream-hash/190203/1 "2010-06-17T16:22:19Z")

</div>

Hi, I’m new to Nginx. Really like it.

I was trying to use it as reverse proxy, with following config:  
http {  
upstream mobile{  
hash $arg\_userid  
server 192.168.0.180;  
server 192.168.0.2:80;  
server 192.168.0.3:80;  
}

```
server {
    listen 80;
    listen 8080;
    server_name mobile.test.com;

     location / {
        proxy_pass http://mobile;
        proxy_redirect off;
        proxy_set_header Host $host;
    }
}

```

# }

The idea is to load balance the request according to “userid” parameter  
in querystring.

It works when I visit: [http://mobile.test.com:8080/?userid=XXX](http://mobile.test.com:8080/?userid=XXX), but not  
[http://mobile.test.com/?userid=XXX](http://mobile.test.com/?userid=XXX)

The request to 8080 port could be hash to different server correctly,  
but the requests to 80 port just sent to random server.

I’m really puzzled.

Any feedback are welcome. Thanks.

Posted at Nginx Forum:

> **[Issue with upstream hash](https://forum.nginx.org/read.php?2,97972,97972#msg-97972)**
>
> Hi, I'm new to Nginx. Really like it. I was trying to use it as reverse proxy, with following config: http { upstream mobile{ hash $arg\_userid server 192.168.0.180; server 192.168.0.2:80; server 192.168.0.3:

---

<div class="post-metadata">

**Author:** ![Wuvist](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/c89c15/32.png) [@Wuvist](https://www.ruby-forum.com/u/Wuvist)\
**Post date:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/issue-with-upstream-hash/190203/2 "2010-06-17T16:22:48Z")

</div>

I’m using Nginx 0.7.66 with upstream hash-0.3 on Ubuntu 8.04.3 LTS.

My config cmd:  
./configure   
–prefix=/usr   
–sbin-path=/usr/sbin/nginx   
–conf-path=/etc/nginx/nginx.conf   
–error-log-path=/var/log/nginx/error.log   
–pid-path=/var/run/nginx.pid   
–lock-path=/var/lock/nginx.lock   
–user=www-data   
–group=www-data   
–with-http\_gzip\_static\_module   
–with-http\_realip\_module   
–http-log-path=/var/log/nginx/access.log   
–http-client-body-temp-path=/var/tmp/nginx/client/   
–http-proxy-temp-path=/var/tmp/nginx/proxy/   
–http-fastcgi-temp-path=/var/tmp/nginx/fcgi/   
–add-module=…/nginx\_upstream\_hash-0.3.1/

Posted at Nginx Forum:

> **[Re: Issue with upstream hash](https://forum.nginx.org/read.php?2,97972,97977#msg-97977)**
>
> Hi, I'm new to Nginx. Really like it. I was trying to use it as reverse proxy, with following config: http { upstream mobile{ hash $arg\_userid server 192.168.0.180; server 192.168.0.2:80; server 192.168.0.3:
