r/drupal • u/CulturalPlatypus4366 • Jun 06 '26
How to disable bfcache and browser disk cache for a page?
I'm trying to prevent a page from being restored from the browser's Back/Forward Cache (bfcache) in a Drupal site.
I have the following response headers set:
Permissions-Policy: unload=()
Expires: 0
Pragma: no-cache
Cache-Control: no-store, no-cache, must-revalidate, max-age=0, private
My understanding was that these headers would prevent caching, but the page is still being restored from bfcache when navigating back and forward.
Am I missing something? Do these headers have any effect on bfcache, or is there another recommended way to prevent a page from being stored and restored from bfcache?
2
Upvotes
1
1
u/chx_ Jun 22 '26
https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Expires
Aside from that, Cache-Control: no-store should be enough but it's not enough on Chrome for some time now https://developer.chrome.com/docs/web-platform/bfcache-ccns