Varnish and Wordpress with amember4 widget

Discussion in 'aMember Pro v.4' started by lifemedia, Dec 22, 2012.

  1. lifemedia

    lifemedia aMember Pro Customer

    Joined:
    Feb 3, 2010
    Messages:
    31
    We are considering using varnish caching and are wondering if anyone else is using it with Wordpress and the amember4 widget?

    I've seen some conversations about issues with varnish and Joomla/amember, but none about Wordpress/amember4 widget. Does that mean that it works well and people are using it without difficulties... or does that mean that I'll be the first to try it?

    I don't see any mention of Varnish, caching, or reverse proxies in the documentation...

    Looking forward to your replies.
  2. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Hi,
    I haven't tested this myself though, but I believe there should not be any issues using aMember/wordpress integration with varnish.
  3. lifemedia

    lifemedia aMember Pro Customer

    Joined:
    Feb 3, 2010
    Messages:
    31
    Hi Alexander,

    OK - thanks for the feedback. We will likely give it a try.
  4. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    All caching plugins and solutions must be configured to do not cache protected pages - either by page URL, or by detecting if authentication cookie is set in Wordpress. Else protected pages may be cached and displayed to guests without authentication.
  5. lifemedia

    lifemedia aMember Pro Customer

    Joined:
    Feb 3, 2010
    Messages:
    31
    Hi Alex,

    Thanks for the reply.

    I think I understand. Just a couple of clarifying questions.

    First, we are using the am4show tag on many pages on the site to protect some content so that it is "members only". So a lot of pages on our site are a mix of open and protected content. I like to think of this as two versions of any give page... "user logged out" and "user logged in".

    I'd like to be able to cache the "user logged out" version of any given page, but for the case of "user logged in" then request should go through to wordpress/amember to deliver the page with the mix of open and protected content (i.e. showing the content in the am4show tags).

    I think you're saying if we should configure to the cache to pass through requests where the "authentication cookie is set in Wordpress." Which cookie are you referring to?

    We are using the amember widget on every page:
    http://www.amember.com/docs/AMember_Provided_WordPress_Widgets

    And... obviously the widget uses some way to detect if a user is logged in.. which I'm assuming is a cookie. If so, are there details or documentation available for that cookie that I can use to make sure we are configuring our cache to pass requests from cookied uses (i.e. "user logged in") through to wordpress/amember?
  6. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    Unfortunately this can't be done. Widget gets information from aMember's session, and session is started every time when user access any aMember's page, and this doesn't matter is user logged in or not.
    Cookie which is being used is PHPSESSID
    What can you try is to customize aMember and add additional cookie which would be set only when user is logged in.
    Then test for this cookie in your config. Contact us in helpdesk I will provide an example of such customization.
  7. lifemedia

    lifemedia aMember Pro Customer

    Joined:
    Feb 3, 2010
    Messages:
    31
    Hi Alex,

    Ok - thanks. I think I'll put this project on hold for a while. Will contact helpdesk when we are ready to give it a try.

Share This Page