Support » Plugin: AMP for WP - Accelerated Mobile Pages » Varnish Compatibility (Issue with Session Keys)

  • Resolved klivnurse


    I am having an issue with Varnish compatibility. The AMP for WP plugin is setting up a session key each time so that cached pages cannot be served.

    Previous mentions of this issue:

    I have determined that it is definitely the AMP for WP plugin that is causing the issue. When I deactivated the plugin, there was no session key, Varnish worked, and desktop speed was cut in half.

    AMP for WP is a great plugin for mobile users. But I need to make sure it’s not negatively impacting desktop users. Was a solution created for this? Or is it still a known issue? Thanks.

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 15 total)
  • Plugin Author Ahmed Kaludi


    Oh, I would really want to improve this since performance is always my biggest priority.

    Can you please help me re-create this?

    So I have a varnish enabled server, How do I see this problem?

    Pantheon has a varnish tester. Here’s the link:

    I’ve been using that to test. I went through all of my plugins one by one, and when I deactivated the Accelerated Mobile Pages plugin, my website passed the Varnish check. So I know the session/caching issue is related to this plugin. Basically this plugin is setting up a session every time, even on desktop, which is blocking the website’s ability to use cached pages.

    Here’s info on the session it’s creating:
    Here’s the link to the development site i’ve been testing on.
    And the live version of the website is

    I’m happy to provide more info. Let me know what else would help with replicating the issue.

    I know you are working on this issue. Let me know if you are able to replicate the problem and if you have a tentative timeline of how long it will take to fix (or if it’s at all possible). I may have to move over to a different AMP plugin, depending on how things go with this.

    Plugin Author Ahmed Kaludi


    We do set session but only when the “Mobile redirection” is enabled. Do you have this option enabled?

    Yes, I do. I disabled Mobile redirection and the website passed the Varnish Check.

    Let me pose a question for you. Wouldn’t a major point of setting up an AMP site be so that mobile users are redirected? When I turn off Mobile Redirection, it’s almost as if the amp site doesn’t exist. What would be the point of keeping your plugin, when there are other plugins that are compatible with caching/varnish?

    Do you think this is something you’ll be working on making compatible, or is the only fix to disable mobile redirection?

    Plugin Author Ahmed Kaludi


    You are absolutely right, we have got to make it compatible with Varnish cache!

    To move forward with it, I’m requesting this enhancement in the Github and we will make this in the upcoming releases:



    Awesome, i’m looking forward to it.

    Do you know tentatively when the next release will come out?

    I’m having the same problem. I started the migration to Pantheon and had the same problems. When I turn OFF the mobile redirection, everything works fine.

    Hi @carolcomandulli

    I ended up removing a bunch of unused, inactive plugins. Somehow that fixed the issue – though i’m not sure what was interacting with the AMPforWP plugin and causing the issue in the first place. Hopefully you’ll be able to replicate it! Sorry I can’t be of more help.

    I also found this thread from + 2 years ago:

    and in the github page seems that the ticket was just closed, the same as the thread in the link above, but no response or fix really happened.

    If this topic is resolved, could you please add some links to the documentation/ release notes/related articles to help who still has the problem?

    Thank you!

    Unfortunately my issue was resolved but I can’t speak to how. That is why they closed the ticket, but if you and others are having the issue and can replicate, they’ll be able to take a closer look at it. I can share the list of plugins I removed, but I don’t know which one specifically caused the problem.

    Share Buttons by Add This
    AMP for Optin
    Slider Revolution
    Postman SMTP
    Ninja Pop Ups
    WP Async CSS
    301 Redirects plugin

    Good luck!

    Hi @klivnurse

    Thank you for answering!
    I disabled every plugin I have and tested. Even if i let just the AMPforWP enabled with the mobile redirection ON, the problem persists.

    I’ve the license, so I opened a ticket with the plugin support. I hope they answer soon.

    Thank you!

    Moderator James Huff


    Volunteer Moderator

    Hi there @carolcomandulli I see you reported this thread to the moderators. Please note that we are just the folks who enforce the rules around all of

    Reporting to moderators doesn’t get any faster support, instead it just kind of attracts attention from folks whose radar you probably don’t want to be on. 😉

    If you really do need a moderator, please add a reply letting us know why before you hit the report button.

    Otherwise, please hang in there for the plugin’s support to reply when they can.

    Hi @macmanx

    Sorry! I didn’t want to bother you guys, but seems that this is a bug and the topic was marked as resolved.

    The same happened to this topic, but seems to be the same problem, without any answer, but +2 years ago:

    Here is the ticket from the plugin’s github page:

    I’m using WordPress 5.2.4, AMPforWP Version and the full mobile redirection turned ON. I can replicate the problem, if it helps, as @klivnurse said, even with just AMPforWP activated. I tested many times.

    You can see a screenshot here:

    Currently, in my live blog, I’m using the mobile redirection ON, but on Digital Ocean + Cloudflare, without problems.

    So, I wasn’t asking for a faster support answer, just to make sure that if the topic is closed as resolved, we could ask for some references to the solution/ fix description, whatever. 🙂

    Thank you!

    Moderator James Huff


    Volunteer Moderator

    We don’t really have any say over how developers choose to support their products, as long as they follow so there isn’t really anything we can do here.

Viewing 15 replies - 1 through 15 (of 15 total)
  • You must be logged in to reply to this topic.