Welcome! Log In Create A New Profile

Advanced

Nginx Session Cookie for Load Balancing

Posted by Titan 
Nginx Session Cookie for Load Balancing
February 10, 2010 12:41PM
Hi,

We currently have Nginx setup to perform load balancing based on the GeoIP module to an IIS 6 backend and this works fine. However we want to implement a method to 'gracefully' upgrade the site running on the IIS backend. Our current method of implementing this is outlined below using snippets from our nginx.conf file.

Config file before upgrade, users are sent to the site on port 8100 of the IIS backend.

[i]upstream A.server {
ip_hash;
server 127.0.0.1:8100 ;
#server 127.0.0.1:8200 ;
}[/i]

Config file during upgrade, new users are sent to the site on port 8200 of the IIS backend and exisiting users should be sent to the site on port 8100.

[i]upstream A.server {
ip_hash;
server 127.0.0.1:8200 ;
server 127.0.0.1:8100 ;
}[/i]

Config file after upgrade, all users should now be sent to the upgraded site on port 8200.

[i]upstream A.server {
ip_hash;
server 127.0.0.1:8200 ;
#server 127.0.0.1:8100 ;
}[/i]

The issue that we have with this configuration is that we want users who close their session on the original website while the upgrade is in progress to be switched to the upgraded site when they revisit the website. However the IP_HASH setting will always return them to the original site, thus we can't set that site offline without kicking them off, which is obviously not something we want to do.

Therefore is there a way of setting a session cookie or something similar in the nginx config that would expire after a set amount of time and so when that user ends their session on the site and then comes back after a period of time they'd be directed to the new site?

Any help on this would be appreciated.

Ewan
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 138
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready