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

XF 1.4 Obvious Errors since moving to load balanced Systems

Discussion in 'Troubleshooting and Problems' started by freakathome, Jan 16, 2015.

  1. freakathome

    freakathome New Member

    Hi there,

    a few days ago we moved to a load balanced system. We have got one load balancer (Apache2, Proxypass) and two web nodes. The two webnodes are configured in php.ini to use the same memcached server for sessions.

    Now we got the following problem: If you login to the Admin Area, the site is going to reload (empty fields). If you press [F5] after that, you'll be logged in. Same in logging out from the forum, the site reloads but you aren't finally logged out by the system.

    Our Cache / Session Settings in library/config.php are configured as follows:
    $config['cache']['cacheSessions'] = true;
    $config['cache']['enabled'] = true;
    $config['cache']['frontend'] = 'Core';
    $config['cache']['frontendOptions']['cache_id_prefix'] = 'xf_';
    $config['cache']['backend'] = 'Memcached';
    $config['cache']['backendOptions'] = array(
    'compression' => false,
    'servers' => array(
       // your memcached server IP /address
       'host' => '',
       // memcached port
       'port' => 11211,
    $config['cookie'] = array(
            'prefix' => 'xemforo_lp_',
            'path' => '/',
            'domain' => ''
    Can you help us?
    Its very critical. I haven't worked with Xenforo before, so it isn't easy for me. I spended a few hours finding the mistake - without a solution.

    Thank you!
  2. Mike

    Mike XenForo Developer Staff Member

    If they're pointing at the same Memcached server, then there's no reason for sessions to not stick. I'd start by disabling the cache to take that out as a variable.

    However, it does sound like there's some element of caching going on. Logging out should be deleting/overwriting cookies on the client, which would mean that your previous session would no longer be available even if session "consistency" was lacking. I'd check your reverse proxy settings.

    Somewhat relevant as well is that you will want to make sure that XF is getting the correct IP via REMOTE_ADDR. You can handle this with a web server extension (something like mod_rpaf) or within XF's config.php to overwrite $_SERVER['REMOTE_ADDR'] with the value from the forwarded header.
  3. freakathome

    freakathome New Member

    We already tried to disable this cache settings, same result.

    Yes, i think so too.

    Should i post the Configuration of the Balancer Apache2?

    We included mod_rpaf before, so the Webnodes finally got the right IP on $_SERVER[REMOTE_ADDR].
    Last edited: Jan 17, 2015
  4. Mike

    Mike XenForo Developer Staff Member

    As far as I've read, ProxyPass doesn't do any caching on its own, though it can be configured to work with mod_cache. I'd look into mod_cache settings.

    In terms of testing, I'd probably test 2 scenarios:
    1. Make sure it works when correctly when accessing the application server directly.
    2. Access the load balancer but take one of the app servers out of the rotation so you know you're always hitting one of them.
    What happens there may influence the troubleshooting approach, though I would note that I know we have multiple customers running in a load balanced environment and I haven't heard of issues such as this from them.
    HWS likes this.
  5. freakathome

    freakathome New Member

    Hi Mike,

    We doesn't do any kind of caching on the ProxyPass Machine.
    Here is the Configuration of the Balancer Apache2, but in case of your two test szenarios i think the problem is going on another reason.
    <VirtualHost *:80>
            ServerName xxxxx.de
            ServerAlias www.xxxxx.de xxx.xxx.xxx.xxx
            DocumentRoot /var/www/
            ProxyRequests Off
            ErrorDocument 503 /error_documents/503.html
            <Proxy *>
              Order deny,allow
              Allow from all
            ProxyPass /error_documents !
            ProxyPass /control-balancer !
            ProxyPass / balancer://lpdecluster/ nofailover=On
            ProxyPassReverse /
            ProxyPassReverse /
            <Proxy balancer://lpdecluster>
              ProxySet lbmethod=bybusyness
            <Location /control-balancer>
              SetHandler balancer-manager
              Order deny,allow
              Deny from all

    I gave one webnode a IP Adress, so i can load it from outside.
    Same issues here, it doesn't work.

    We got the same errors as before, i deactivated one of the two webnodes to only jump on / visit one at this test time. Same result.
  6. freakathome

    freakathome New Member

    I think i got it working now.

    I activated mod_cache on both machines
    a2enmod cache
    and after that i added this to the .htaccess in xenforo path
    Header set Expires "Thu, 19 Nov 1981 08:52:00 GM"
    Header set Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
    Header set Pragma "no-cache"
    Okay, we got now some issues with Plugins, using cache systems.
    Do you got a solution for that?
    Last edited: Jan 17, 2015
    duderuud likes this.
  7. Mike

    Mike XenForo Developer Staff Member

    I would note that we send some of those headers by default. They should be enough to stop subsequent requests from using them.
    header('Expires: Thu, 19 Nov 1981 08:52:00 GMT');
    header('Cache-control: private, max-age=0');
    They're not as aggressive though. (The headers listed in your post would prevent the back button from serving a cached page.) But if it works for you...

    I'm unsure what you're referring to with your edit.

Share This Page