We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!

Answered Nginx Caching

    • 28883
    • 35 Posts
    Hi, I'm managing a multi-tenant instance of modx. I'm using nginx as my web server and have recently turned on nginx caching. It's amazing the difference it's made to these sites! Really amazing!

    My only problem is that, it's interfering with the manager, despite setting directives to not cache the manager.

    The problem I experience is that, once I've logged out, if I try to login again, the manager tells me that my session has expired and it presents me with a login modal, but despite re-authenticating, I can never get rid past this point (unless I clear the nginx cache).

    Obviously something is getting cached, which is mucking with the session, but I don't know how to overcome this. I've tried so many options...

    My current directives are:

    if ($request_uri ~* "/manager/") {
        set $skip_cache 1;
    }
    


    and

    location /manager {
        set $skip_cache 1;
        add_header Cache-Control no-cache;
    }
    


    If anyone has any idea what directives to use, I really appreciate your sharing your learnings smiley

    This question has been answered by supanick. See the first response.

    • discuss.answer
      • 28883
      • 35 Posts
      Not to worry. I tried a different approach. I've turned off the nginx fast cache and just ensured that all static resources are cached in the browser...

      That, combined with the memcached caching means the sites are plenty fast.
        • 51775
        • 1 Posts
        Hi! I have same problem. Have you ideas to solve it without disabling nginx cache?
        • I'm not familiar with nginx caching myself, but you may get better results by also disabling it on the connectors directory.
            Mark Hamstra • Developer spending his days working on Premium Extras and a MODX Site Dashboard with the ability to remotely upgrade MODX and extras to make the MODX world a little better.

            Tweet me @mark_hamstra, check my infrequent blog at markhamstra.com, my slightly more frequent ramblings at MODX.today or see code at Github.