Caching a WordPress membership site with a page cache or CDN

A page cache stores one copy of a page and serves it to everyone. That is safe on a membership site only if a member’s page never becomes the copy a guest gets. RedeemID is built so the shared copy is always the guest’s.

What stays cacheable

Guests always get the locked view, so it can be cached and shared like any public page. Personal parts, such as the sign-in control, the account card and the plan card’s “your plan” wording, are dynamic islands: the cached page carries a neutral placeholder and the browser fills it in for each visitor after load. Pages hold no personal data and no nonce.

What RedeemID marks private

Any response that shows something only a member should see (a granted item, the members area of a gate, a member-aware plan card) sets DONOTCACHEPAGE for page-cache plugins and Cache-Control: private, no-store for CDNs and proxies.

The X-RedeemID-Access header

Every gated item’s own page sends X-RedeemID-Access with one of:

  • open: the item isn’t locked;
  • locked: this visitor got the wall (safe to cache);
  • granted: this visitor can read it (never cache);
  • bypass: an editor is reading it in full (never cache).

A CDN rule can use it to cache open and locked responses and skip the rest, or to log how often members hit locked pages.

Cookies to bypass

Cache rules should skip the cache when the request carries one of these cookies:

  • wordpress_logged_in_*, the signed-in session;
  • redeemid_oauth_state and redeemid_pending, during sign-in;
  • redeemid_fset, only when a feature declares the vary caching option;
  • redeemid_cart, on the cart page.

Most managed WordPress hosts already skip the cache for wordpress_logged_in_*. Check that yours does, and add the RedeemID cookies to the list. Features that change a page per member have their own caching options; see Features.

Check it

Fetch a locked item twice in a private window and check the second response came from the cache and shows the wall. Then sign in as a member and check you get the full item with X-RedeemID-Access: granted.

Written for: Membership sites, Agencies

RedeemID is still being built

RedeemID is a WordPress plugin that lets customers sign in with their Shopify account and opens your site to what that account holds. It is in early development, so parts of this site are unfinished and details will change.

It is coming soon. We are looking for sponsors and for the first stores and publishers to use it.

For more information, email vinny@vinnysgreen.com.

Get in touch