Bypassing cache for private account and checkout pages

Private account, cart and checkout responses must not be shared between visitors. Use explicit cache bypass rules alongside correct application headers and test with distinct user sessions.

What you need before you begin

Inventory private paths, session cookies, authenticated downloads and application endpoints. Include custom login URLs and APIs rather than relying on a generic list copied from another site.

01 Bypass cache for private account and checkout pages

  1. Create a Cache Rule that matches the intended hostname and private paths or appropriate authentication/session conditions.
  2. Set the action to Bypass cache. Use separate clear conditions when that makes the rule easier to audit.
  3. Review its order so a later broad cache rule cannot override the bypass. Check Workers and other caching layers too.
  4. Purge any private objects that may already have been cached using the correct scope. Fix the application’s Cache-Control headers and origin page-cache exclusions.
  5. Test signed-out access and two separate signed-in accounts, checking headers and page contents without exposing real customer data.

02 Example: bypass the actual private store paths

For a shop using the standard path names below, this example Cloudflare Cache Rule expression identifies the cart, checkout and account areas. Replace the hostname and paths with those actually used by your store, then choose Bypass cache.

Code or configuration example
http.host eq "shop.example.com" and (
  http.request.uri.path eq "/cart" or
  starts_with(http.request.uri.path, "/cart/") or
  http.request.uri.path eq "/checkout" or
  starts_with(http.request.uri.path, "/checkout/") or
  http.request.uri.path eq "/my-account" or
  starts_with(http.request.uri.path, "/my-account/")
)

This is a path example, not a complete store cache policy. Inventory custom slugs, order confirmations, session cookies, AJAX and API endpoints too. Review rule ordering and the origin’s cache exclusions so another layer does not continue sharing personalised HTML.

Expected result: Two isolated test accounts see only their own cart and account information. The bypass covers both slash variants and relevant nested paths while ordinary public static assets remain separately cacheable.

Confirm the expected result

Private content should come from the correct application session and should not be served as another visitor’s cached page. Public static assets can still use caching independently.

Troubleshoot unexpected results

A CDN bypass does not disable a WordPress cache plugin, server page cache or browser cache. If private data was exposed, stop the affected caching behaviour and investigate the extent rather than merely clearing one browser.

Is checking only the checkout URL enough?

No. Cart fragments, account APIs, order confirmations and authenticated downloads may use different paths or cookies. Test the application’s complete private workflow.

  • 0 Users Found This Useful
  • performance
Was this answer helpful?

Related Articles

Using Cloudflare Always Online for limited outage fallback

Always Online can provide limited cached or archived public content when the origin is...

Distinguishing browser cache lifetime from edge cache lifetime

Browser cache lifetime and Cloudflare edge lifetime control different copies of a resource....

Checking why cookies prevent or alter Cloudflare caching

Cookies influence application state, but the presence of a request cookie does not universally...

Controlling query-string caching without mixing different content

A cache key decides which requests share one cached response. Query parameters can identify...

Creating a cache rule for public static assets

A cache rule can make a known public asset path eligible for edge caching. Scope the rule to...