Forum Discussion
Nginx as Reverse Proxy
You should choose least connection by doing this:
upstream tomcat{
least_conn;
server 192.168.x.y:8080;
server 192.168.x.y+1:8080;
}
With this nginx will send all requests evenly to both servers and will choose the server with less connections for new ones.
But, since nginx cant work with persistance cookies (only nginx plus) it will choose the next connection by the requested ip address and this will always be the LoadBalancer IP. So nginx assumes this is allways the same user and redirects this to always the first choosen backend server.
But you can trick this by setting the following
real_ip_header X-Forwarded-For;
set_real_ip_from IPv4_LB_IP;
in the server context (works only if nginx comes with realip module)
Try and restart and let me know if this was correct 🙂
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com