server persistance using sticky cookie

mondji nginx-forum at forum.nginx.org
Wed Feb 24 02:54:00 UTC 2021


Hi,
I have setup this module
https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/src/master/ to
have an upstream server persistance using cookies, 
I compiled nginx 1.18.0 with this module suscessfully.

Here is my loadbalancer configuration:

/etc/nginx/conf.d/loadbalance.conf

proxy_cache_path /path/to_cache/dir keys_zone=backcache:10m;

upstream backendServers {
  server IP1:81;
  server IP2:81;
sticky name=mysticky expire=10860 path=/;
}


server {
    listen IP3:80;
    server_name example.com;
    
        location / {
        return 301 https://$server_name$request_uri;
    }
}

server {
    listen IP3:443 ssl;
    server_name example.com;
    
    location / {
        proxy_pass https://backendServers;  
        proxy_http_version 1.1;  
        proxy_set_header Upgrade $http_upgrade;  
        proxy_set_header Connection $connection_upgrade; 
        ...
    }
}

backend servers are running iis linked with coldfusion (tomcat).
The sticky seems not working: when I stop a web site on server 1, nginx
continue to send requests to that
server. The loadbalance occures only when I clear the browser cache, or
reboot server 1.
The cookie is set (name, expiration,...) but nginx is "sticked" to the down
server.

Is someone here who has tested thi s module
(https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng/src/master/)
with recente nginx version
If yes, is it working ? ciuld you share your experience ?

Thanks

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,290835,290835#msg-290835



More information about the nginx mailing list