Issue with upstream hash

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 {
    listen 80;
    listen 8080;

     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:, but not

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:

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

My config cmd:

Posted at Nginx Forum: