2

I am using nginx as the load balancer and IIS to server asp.net pages. However I am having trouble figuring out how to set sticky session in nginx. Is it possible? Thanks.

3

The Upstream module does this. In http section:

upstream app {
  ip_hash;

  server backend1;
  server backend2;
}

In your location:

location / {
  proxy_pass http://app;
}
0

The above answer is correct, to include ip_hash; in your upstream configuration, but I wanted to add, do not fair; or weight or other configurations in upstream as they can conflict with the ip_hashing... If you need sticky sessions based on something other than the IP of the visitor, time to go looking...

http://wiki.nginx.org/NginxHttpUpstreamModule

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.