I have set up a load balancer with NGINX for two IIS web servers that works with sessions. Here is the NGINX configuration file I have created for the load balancing:
#Log Format log_format upstreamlog '$server_name to: $upstream_addr [$request] ' 'upstream_response_time $upstream_response_time ' 'msec $msec request_time $request_time'; #Upstream upstream mybalancer { ip_hash; server server1.com:80; server server2.com:80; } #Server server { listen 80; listen [::]:80; server_name server3.com; access_log /var/log/nginx/access.log upstreamlog; location / { proxy_pass http://mybalancer; proxy_http_version 1.1; proxy_set_header Host $host; proxy_set_header X-Forwarded-Host $server_name; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } } When I make a request to server3.com it gets redirected -for example- to server1.com. Next I make the login, go to a specific page, let's say: server1.com/welcome/maps. Everything is ok. Now I turn off server1.com, and NGINX redirects me to server2.com, but prompts me to the login page. My question: It's possible to configure NGINX to keep the same sessions when one server goes down? This means that -in my example- NGINX could redirect me to server2.com/welcome/maps with the same session. PD: I have read on other posts about setting this options: proxy_cookie_path ~*^/.* /; add_header "Set-Cookie" "lb=$upstream_http_X_Loadbalance_ID"; but does not works. Posted at Nginx Forum: https://forum.nginx.org/read.php?2,287447,287447#msg-287447 _______________________________________________ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx