Page prevented back/forward cache restoration: how to fix

Why Chrome reloads your page when a visitor presses Back, how to find the blocker in DevTools, and how to replace no-store headers safely.

Arjen Karel
Updated · 7 min read
Share

Why did your page prevent back/forward cache restoration?

Page prevented back/forward cache restoration means Lighthouse left your page right after it loaded, pressed Back, and Chrome loaded the page again instead of showing it from memory. A common cause is Cache-Control: no-store on public HTML while a cookie changes. Send Cache-Control: no-cache on public pages and keep no-store on account and checkout.

Just want the quick fix? Jump to WordPress and WooCommerce, Shopify, Cloudflare, your own server or a frame from another domain.

How does Lighthouse check the back/forward cache?

Lighthouse leaves your page right after it loaded, goes back and lists Chrome's reasons for loading it again. Lighthouse's config for pagespeed.web.dev skips this notice, so you see it in DevTools or the Lighthouse CLI. Its description reads: "Many navigations are performed by going back to a previous page, or forwards again. The back/forward cache (bfcache) can speed up these return navigations."

Lighthouse Diagnostics report showing Page prevented back/forward cache restoration with 3 failure reasons and Unscored: one reason for cache-control:no-store that Lighthouse marks as fixable on the page, and two for the main resource and a JavaScript network request marked as outside it, each listing acme-trailgear.test/rain-jackets/ underneath

The notice in Lighthouse on mobile (simulated throttling).

Under each failure reason Lighthouse shows the frame URL and a "Failure type": the fix is in your page's code or headers, in Chrome ("Pending browser support": a feature Chrome cannot cache yet), or outside the page. The notice is "Unscored", but return visits count in your real visitors' Core Web Vitals.

What happens when your visitor presses Back?

Your visitor taps a product, presses Back and waits while the category page loads again. The back/forward cache would show it at once: Chrome keeps the rendered page in memory with its scripts paused and needs no network request (what a restore does to TTFB).

On a test page, a hiking gear shop's rain jackets category built like a WooCommerce shop, Back took 601 ms to paint when the page loaded again and 5 ms from memory with Cache-Control: no-cache, throttled like Lighthouse's DevTools mobile preset. The test page has inline CSS and no images; real shops take longer.

Where in DevTools do you test a single URL?

The Back/forward cache panel in Chrome DevTools runs this check on one URL.

  1. Open the URL in Chrome Incognito with extensions off: a WordPress login adds WordPress's own no-store header, and extensions add their own lines.
  2. Open DevTools > Application > Background services > Back/forward cache.
  3. Click Test back/forward cache.
Chrome DevTools Application panel under Back/forward cache on the rain jackets page: Not served from back/forward cache, Frames showing 3 issues found in 1 frame, CacheControlNoStoreHTTPOnlyCookieModified in the first group, and MainResourceHasCacheControlNoStore plus JsNetworkRequestReceivedCacheControlNoStoreResource in the second

The rain jackets test page before the fix.

A blocked page shows "Not served from back/forward cache", the reasons grouped by failure type with Chrome's protocol name (such as CacheControlNoStoreHTTPOnlyCookieModified), and under "Frames" the URL of the page or iframe that blocks it.

Why does one no-store header give three failure reasons?

The three lines have one cause: the HTML sends Cache-Control: no-store, and a cart or session request that is also no-store updates a cookie. Lighthouse then lists:

  • "Pages with cache-control:no-store header can’t enter back/forward cache";
  • "Pages whose main resource has cache-control:no-store can’t enter back/forward cache";
  • "Back/forward cache is disabled because some JavaScript network request received resource with Cache-Control: no-store header".

Lighthouse marks the first as yours to fix and the other two as outside your page, yet all three go with the same header. Under Chrome's no-store rules, Chrome 158 caches a no-store page for up to 3 minutes, blocking it if a cookie changes or a script requests a no-store URL. Switching public HTML to Cache-Control: no-cache clears all three while your cart endpoint keeps its header and cookie.

How do you fix Page prevented back/forward cache restoration?

Start with the line Lighthouse marks as yours to fix. When it is a no-store line under your public URL, send Cache-Control: no-cache on that HTML: normal loads still check with your server, and Back restores from memory.

WordPress and WooCommerce

WordPress core sends Cache-Control: no-cache, must-revalidate, max-age=0, no-store, private only to logged-in users. WooCommerce 10.1 and newer leaves no-store off Cart, Checkout and My Account for guests, and wc-cart-fragments already refreshes the mini-cart on pageshow, so update an older WooCommerce first. On public pages, check:

  • W3 Total Cache: in Performance > Browser Cache > HTML & XML, switch Cache Control policy from don't store ("no-store") to don't cache ("private, no-cache").
  • WP Fastest Cache: writes no-store into .htaccess on cached HTML, with no setting for it; switch plugins or have your developer change that rule.
  • WP Rocket: in Plugins > Installed Plugins, deactivate "WP Rocket | Add custom htaccess rules to set no-store on HTML" once logged-in caching is fixed.
  • Session or login plugins: nocache_headers() and PHP session_start() send no-store, the second with PHPSESSID; restrict that plugin to login and member URLs.

Then log out, add a product to the cart, press Back to see the mini-cart update, and check that /my-account/ keeps no-store when signed in.

Shopify

Shopify sets the storefront headers, with nothing to change in Admin or the theme, and the store I checked sent no Cache-Control on its HTML. So check whether the notice names an app's frame or request: disable unused theme app embeds, uninstall old apps, or send the vendor the reason and URL. On Hydrogen, keep CacheNone() off public routes.

Cloudflare

Cloudflare passes an origin no-store on to the browser, also with Browser TTL and Edge TTL set in Caching > Cache Rules, so fix the origin first. If Cloudflare adds no-store itself, check Caching > Cache Rules (Status Code TTL) and Response Header Transform Rules.

Your own server or framework

Set Cache-Control: no-cache in your plugin, PHP code or framework; put an Nginx or Apache rule only on a location that serves nothing but public HTML.

Next.js sends Cache-Control: private, no-cache, no-store, max-age=0, must-revalidate on dynamic routes, and cookies(), headers() or connection() in a root layout makes every public page dynamic. Move user state to a client fetch, or call res.setHeader('Cache-Control', 'no-cache') on public getServerSideProps pages.

Pages that must keep no-store

Keep Cache-Control: no-store on member areas, /account and /checkout, or someone pressing Back on a shared computer after signing out can see private pages from memory. Check the session on pageshow when event.persisted is true, and refresh cart badges the same way:

// Account and checkout templates: reload if the user signed out
window.addEventListener('pageshow', (event) => {
  if (event.persisted && !document.cookie.match(/my-cookie/)) {
    location.reload();
  }
});

// Public templates: refresh dynamic UI after a bfcache restore
window.addEventListener('pageshow', (event) => {
  if (event.persisted) {
    updateCartCount();
  }
});

With an HttpOnly session cookie, set a readable login cookie or ping a session endpoint inside if (event.persisted).

A frame from another domain

When the frame URL is a consent, chat, video or ad service on another domain, update the vendor's tag, check its settings in Google Tag Manager, or load chat and video embeds on click. If the line stays, keep the widget off the category and search pages visitors return to with Back, and send the vendor the reason and URL.

Which failure reasons can you leave?

Leave the notice red on logged-in, account and checkout pages, where no-store protects personal data. The other lines, and what to do with them:

  • "Internal error": a frame in the cached page (such as a consent, ad or chat iframe) tried an action Chrome doesn't allow while cached. In a consent or ad frame you need, it can stay.
  • "The page was evicted from the cache because an active network connection received too much data": an open stream overflowed Chrome's buffer. Abort your own streams on pagehide; a third-party one can stay.
  • "The page was opened using 'window.open()' and another tab has a reference to it": a popup or link left window.opener set without noopener. Add it.
  • "Only pages with a status code of 2XX can be cached": the URL returned an error status such as 404 or 500 instead of 200. Fix the URL.
  • "Back/forward cache is disabled due to extensions": a Chrome extension messaged the tab; test in Incognito.

Does Chrome serve the page from memory after the change?

Run Lighthouse in Incognito again, with the same settings: a clean page passes the notice ("Page didn't prevent back/forward cache restoration"). The DevTools test now says "Successfully served from back/forward cache".

Chrome DevTools Application panel under Back/forward cache on the rain jackets page after the fix, with a green check mark and Successfully served from back/forward cache

The rain jackets test page after the fix.

How I check this in real-visitor data

DevTools tests one browser right after the load, while real visitors press Back minutes later, on phones with tight memory and in Safari and Firefox too. In CoreDash, the Real User Monitoring tool I built, I open the FCP page and check the "Arrival" card: "Back/forward" (the page loaded again) sits next to "Back/forward from bfcache" (restored from memory), and in Explore I split each page group by "Not restored reason (bfcache)" to see why return visits loaded again. After a fix goes live, I watch "Back/forward from bfcache" grow on those templates; see my guide on what a normal bfcache restore rate is and what keeps pages out across real visitors.

Finding which plugin, host setting or CDN rule adds the no-store, or whether a consent or ad frame stays on your category pages, takes more than one Lighthouse run. Bring the URL to a Core Web Vitals power hour: together we read your live headers and the frames in DevTools and decide what changes where.

About the author

Arjen Karel is a web performance consultant and the creator of CoreDash, a Real User Monitoring platform that tracks Core Web Vitals data across hundreds of sites. He also built the Core Web Vitals Visualizer Chrome extension. He has helped clients achieve passing Core Web Vitals scores on over 925,000 mobile URLs.

Arjen Karel

Need a faster site?

I'm Arjen, and I've been fixing slow sites for 17 years. If you're running into issues you can't fix yourself, send me your URL and let's have a chat.

Send me your URL
Arjen Karel
Arjen Karel, Web performance consultant since 2009

Why isn't our fix working?

Sometimes the CDN still serves the old HTML, or the fix went into the desktop template and mobile uses another one. Send me your URL and the problem, and I reply with a few times. I check your field data first, then we spend one hour on your site, and within a day you have my notes in writing. €350 excl. VAT.

Send me your URL

No developer to build the fix? I do the work myself, on a copy of your site.

Arjen KarelCore Web Vitals still red on mobile?Send me your URL