Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Logged-in cache served to visitors: how to find and fix it

CNV-382Medium impactCould addBy FunnelGuardPublished Updated
On this page

What this issue is

A cache keeps a saved copy of a page so it loads fast. That is fine for pages that look the same for everyone. It goes wrong when the saved copy was made for a logged-in user and the cache hands it to anonymous visitors.

Typical causes: a CDN that caches HTML ignoring cookies, a WordPress caching plugin without a rule for the login cookie, a missing Vary: Cookie header, or personal content (mini-cart, greeting, account menu) rendered on the server into a cached page.

How a private page leaks
  1. Customer logs inPage is built with their name and cart
  2. Cache stores pageNo rule excludes logged-in responses
  3. New visitor requests itGets the saved copy
  4. Visitor sees wrong dataWrong name, cart or dead forms

The cache saves the first response and replays it to everyone after.

Why it costs you leads or sales

Visitors who see another person's name or cart lose trust and leave. Forms inside a cached page can carry the wrong security token and be rejected. Buttons such as Add to cart or Log in may point to the wrong state. There is also a privacy risk: personal data shown to strangers can create legal trouble.

The problem is often intermittent, so it hides. Staff are logged in and see a normal site, while guests get the bad copy.

Checkout starts by page versionExample numbers
Checkout starts by page version (example)Correct guest page: 6 %; Leaked logged-in page: 2 %02562Correct guest pageLeaked logged-in page%

Example: illustrative numbers showing how visitors who get a leaked logged-in page may start checkout less often.

How to check if your site has it

Test for leaked logged-in pages
  1. Compare logged-in and guest views

    Log in in one browser. Open the same URL in a private window with no login. Look for names, cart counts, admin bars or account links showing in the guest view.

  2. Check response headers

    In browser dev tools, Network tab, click the page request and read the response headers. Look at Cache-Control, Age, Vary and any cache status header such as X-Cache or CF-Cache-Status.

  3. Test with curl

    Request the page without cookies, then with a login cookie, and compare the output and cache headers.

  4. Look at personal URLs

    Check /cart, /checkout, /my-account and any page with a greeting or mini-cart.

Compare cache headers with and without a cookiebash
curl -sI https://example.com/cart/ | grep -iE 'cache-control|age|vary|x-cache|cf-cache-status|set-cookie'
curl -sI -H 'Cookie: wordpress_logged_in_xxx=test' https://example.com/cart/ | grep -iE 'cache-control|age|vary|x-cache|cf-cache-status'

How to fix it

The rule is the same everywhere: pages that depend on who the user is must not be stored in a shared cache. The exact setting depends on your platform and cache layer.

Fix by platform
  1. Exclude logged-in users from page cache

    In your caching plugin, turn on the option to not cache pages for logged-in users (the wording varies by plugin).

  2. Exclude cart pages and cookies

    Add /cart, /checkout and /my-account to the never-cache list. For WooCommerce, also exclude the woocommerce_items_in_cart and wp_woocommerce_session cookies.

  3. Purge all caches

    Clear the plugin cache, server cache and CDN cache, then retest as a guest.

Nginx: skip the cache when a login cookie is presentnginx
set $skip_cache 0;
if ($http_cookie ~* "wordpress_logged_in|woocommerce_items_in_cart|wp_woocommerce_session") {
    set $skip_cache 1;
}
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
PHP: mark a personal response as not cacheablephp
<?php
header('Cache-Control: private, no-store');
header('Vary: Cookie');
Cache behaviour

Before

  • Cart page cached for everyone
  • No Vary or private header
  • Guests see a stranger's name

After

  • Personal URLs bypass the cache
  • Private header on user-specific responses
  • Guests always get the generic page

How to confirm it's fixed

Confirmation checks
  • Purge every cache layer (plugin, server, CDN).
  • Log in, load the personal page, then open it as a guest in a private window: no personal data shows.
  • Headers on personal pages show private or no-store and a cache status of MISS or BYPASS.
  • Repeat the check on mobile and from a different network.
  • Submit a test form as a guest and confirm it goes through.

How to prevent it happening again

Prevention habits
  • Keep a written list of URLs and cookies that must never be cached.
  • Re-test after changing plugins, themes, CDN rules or hosting.
  • Avoid putting names or cart data in server-rendered HTML that gets cached; load them after the page loads.
  • Check as a guest, not only as an admin, after every release.
  • Set a short cache lifetime for HTML pages that must be cached.

How FunnelGuard handles this

FunnelGuard does not check for this yet. Spotting a leaked logged-in page is a possible future check, not a current feature.

What it does cover nearby: a robot visitor runs your real journeys, such as lead forms and checkouts, as a guest on a schedule. It checks each step and the tracking hits sent to ad and analytics platforms. If a leaked page breaks a form or a button, the journey can fail and you get one alert with a screenshot and a likely cause. It will not tell you a stranger's name appeared on the page.

To watch for this yourself, add a monthly guest-versus-logged-in comparison to your release checklist, and use your CDN's cache analytics to see whether HTML for cart and account URLs is being served from cache. FunnelGuard has a Free plan (1 site, 2 journeys, daily checks, no card) if you want guest journeys tested automatically.

Questions people ask

Why is my website showing another user's name to visitors?

A cache probably saved a page built for a logged-in user and is serving it to guests. Check that your page cache or CDN bypasses cache when a login or cart cookie is present, then purge all caches.

How do I stop a CDN caching logged-in pages?

Add a rule that bypasses cache when session or login cookies are present, and send Cache-Control: private on user-specific responses. Also make sure cart, checkout and account URLs are never cached.

Why does my cart show items I did not add?

Your cart page or mini-cart was likely cached and shared between visitors. Exclude cart URLs and cart cookies from the cache, and load cart counts dynamically.

Does Cache-Control private stop shared caching?

Yes. private tells shared caches such as CDNs and proxies not to store the response, while allowing the user's own browser to keep it. Use no-store for the most sensitive pages.

How can I test if my site serves logged-in cache to guests?

Log in in one browser, load the page, then open the same URL in a private window. Compare content and check headers such as Age and X-Cache for signs it came from cache.

Is a leaked logged-in page a privacy problem?

It can be. If names, emails, orders or addresses reach other visitors, that may count as a data exposure. Fix it quickly and consider getting legal advice if real customer data was shown.

Does FunnelGuard detect logged-in cache leaks?

No, not yet. It is a possible future check. FunnelGuard does run guest journeys on a schedule, so a leak that breaks a form or button may show up as a failed step.

Does FunnelGuard catch this?

Could add

Not checked yet: could be added to FunnelGuard.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.