Welcome! Log In Create A New Profile

Advanced

Re: Nginx load balancing to keep sessions between IIS servers

Francis Daly
March 27, 2020 04:34AM
On Tue, Mar 24, 2020 at 06:01:35PM -0400, robe007 wrote:

Hi there,

> I have set up a load balancer with NGINX for two IIS web servers that works
> with sessions.

What is "a session"?

The answer to that may make it clear how to achieve what you want.

> upstream mybalancer {
> ip_hash;
> server server1.com:80;
> server server2.com:80;
> }
>
> #Server
> server {
> server_name server3.com;
> location / {
> proxy_pass http://mybalancer;
> }
> }
>
> 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.

That... probably should not happen.

In a reverse proxy situation, your client should not know (or care)
whether it is talking to server1 or to server2 -- it only interacts
with server3.

(It is possible that I am just misunderstanding the terminology here.)

> Now I turn off server1.com, and NGINX redirects me to server2.com, but
> prompts me to the login page.

I think "no".

server2 asks you to login; nginx does not. And that difference matters
here.

> 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.

Back to the first question -- what is a session?

I suspect that in your system it is "state stored on the back-end server1
or server2"; and it is not anything that the browser knows about and
not anything that nginx knows about. The browser might have a "key"
to the session in a cookie.

If that is the case, then the fix would be for you to make sure that
server1 and server2 both have the same shared idea of a session, so that
the same cookie sent to either server will end up with the same response.

And there is nothing the nginx can do about arranging that.

f
--
Francis Daly francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
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: 43
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