least_conn method session issue

Maxim Dounin mdounin at mdounin.ru
Fri Oct 21 22:36:46 UTC 2022


On Fri, Oct 21, 2022 at 06:04:00PM -0400, Dr_tux wrote:

> I use least_conn in Nginx (reverse proxy), but when I open the application's
> dashboard, it logs out. It doesn't do this in ip_hash method. What should I
> do for this? I m stuck in this situation, I can use least_conn on AWS and it
> 's working properly. 

Is your application's dashboard able to maintain user session 
across different backend servers?  Symptoms suggests it probably 
doesn't, so you have to either configure your backend to ensure 
session sharing between servers[1], or use some forms user-aware 
balancing such as ip_hash or hash.

[1] For example, in PHP there are standard ways to store sessions 
across multiple servers, such as memcached, see 
https://www.php.net/manual/en/memcached.sessions.php for details.

Maxim Dounin

More information about the nginx mailing list