Choose upstream based in a cookie

nfn nginx-forum at nginx.us
Thu Feb 17 02:10:24 MSK 2011


Hello,

Is this the right way to switch backend based in cookies?

[code]
        location / {
                if ($http_cookie ~* "memberid=") {
                        proxy_pass              http://10.10.10.10;
                        break;
                }
                if ($http_cookie ~* "clientid=") {
                        proxy_pass              http://10.10.10.15;
                        break;
                }
                proxy_pass              http://10.10.10.20;
        }
[/code]

Thanks.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,170775,176001#msg-176001




More information about the nginx mailing list