1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Two frontend nodes (nginx), losing session between them

Discussion in 'Server Configuration and Hosting' started by Abracadaniel, May 9, 2015.

  1. Abracadaniel

    Abracadaniel Member

    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?
    Last edited: May 9, 2015
  2. alegeek

    alegeek Member

    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.
    Abracadaniel likes this.
  3. Abracadaniel

    Abracadaniel Member

    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?
  4. Mike

    Mike XenForo Developer Staff Member

    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).
    Abracadaniel likes this.
  5. Abracadaniel

    Abracadaniel Member

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

Share This Page