Two frontend nodes (nginx), losing session between them

Hi there!

Using two nginx as reverse proxy to backend with XenForo.
Going between different pages, forum randomly logouting me (with no "remember me").

Why this could be happening, and what I can do to prevent this?
Thanks!
 
Last edited:
You either need to put your sessions into a caching system such as memcache or have them use the same server all the time using ip_hash in your upstream configuration.
 
You either need to put your sessions into a caching system such as memcache or have them use the same server all the time using ip_hash in your upstream configuration.
Thanks for reply!

Currently I have 1 backend and 2 frontends.
Backend holding sessions at memcached.

Why switching between 2 frontends could reset a session? Is it related to XenForo security that checking IP source of connection, and dropping session to prevent someone hijacking into existing one from other source IP?
 
Is it related to XenForo security that checking IP source of connection, and dropping session to prevent someone hijacking into existing one from other source IP?
If XenForo is seeing the IP as your load balancers, meaning the IP is changing, then yes. You should expose the "real" IP to XenForo (generally by overwriting $_SERVER['REMOTE_ADDR'] with the header that contains the correct value in config.php).
 
If XenForo is seeing the IP as your load balancers, meaning the IP is changing, then yes. You should expose the "real" IP to XenForo (generally by overwriting $_SERVER['REMOTE_ADDR'] with the header that contains the correct value in config.php).
Totally forgot about that part. Yes, looks like I didn't authorized the second frontend at backend to receive REMOTE_ADDR.
Many thanks for pointing it out in details. =)
 
Top Bottom