Issue with upstream hash

Wuvist nginx-forum at
Mon Jun 14 17:18:08 MSD 2010

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:,97972,97972#msg-97972

More information about the nginx mailing list