March 24, 2020 06:01PM
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 mybalancer {

server {
listen 80;
listen [::]:80;

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 it gets redirected -for example- to Next I make the login, go to a specific page, let's say: Everything is ok.

Now I turn off, and NGINX redirects me to, 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 with the same session.


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.
Subject Author Posted

Nginx load balancing to keep sessions between IIS servers

robe007 March 24, 2020 06:01PM

Re: Nginx load balancing to keep sessions between IIS servers

Francis Daly March 27, 2020 04:34AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 96
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready