ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Load Balancer Caching Logged in User Output

December 04, 2008 3:12pm

Subscribe [2]
  • #1 / Dec 04, 2008 3:12pm

    Cameron Corda

    31 posts

    We’re trying to reduce server load by running our sites through a load balancer (ZXTM) to serve content as static pages.

    We’re running into a problem however on a few sites that must use sessions only.  What happens is a logged in user loads a page that has pagination.  For some reason that pagination code has the user’s session ID in the link.  That pagination code then gets cached by the load balancer and is served to all users.

    Another problem is that we have a variety of content we only serve to logged in users like links to “Edit this Entry”.  For now we’ve had to disable that code.

    This may turn into a feature request to add the ability to send no-cache headers whenever a {member_group} conditional is satisfied.

    In the short term however, we’re trying to manually send the following headers only to logged in users.

    <?
    header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    header ("Cache-Control: no-store, no-cache, must-revalidate");
    header ("Pragma: no-cache");
    ?>

    Ideally we’d put that in a an embeddable template, and call it like so:

    {if member_group == "1"}{embed="phpee/no-cache"}{/if}

    However we’ve been unable to figure out how to get the first snippet of code to work, let alone the second.

    I’ve tried adding ‘exit();’, and then the headers will get sent, but none of the content will.

    Suggestions?

  • #2 / Dec 04, 2008 5:50pm

    Derek Jones

    7561 posts

    Cameron, I bet the Output class’s own headers are overwriting the ones you’re attempting to use.  Instead of modifying core.output.php, though, you could try modifying the system offline extension I wrote awhile back, which demonstrates how to extend the output class without having to modify that core file.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases