Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of Cache-Control: no-store, no-cache, max-age=0 should be flagged by Site Health for unauthenticated frontend responses #1692

Open
westonruter opened this issue Nov 21, 2024 · 5 comments
Labels
[Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only [Type] Enhancement A suggestion for improvement of an existing feature

Comments

@westonruter
Copy link
Member

Browsers have typically prevented a page from being served from bfcache when is served with Cache-Control: no-store. For example, in Core-21938 this was done to prevent a cached page from being accessed after a user logs out of WordPress. However, there are many sites that serve Cache-Control: no-store even to unauthenticated requests. This is the number one reason for why bfcache is disabled in WP sites, as is seen at GoogleChromeLabs/wpp-research#75.

Chrome is currently experimenting with enabling bfcache when pages are served with Cache-Control: no-store, but there are scenarios still where such pages remain ineligible.

A Site Health test can be added which warns sites when they served unauthenticated responses with Cache-Control: no-store as this can make them ineligible for bfcache and thus negatively impact navigation performance.

@westonruter westonruter added [Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only [Type] Enhancement A suggestion for improvement of an existing feature labels Nov 21, 2024
@github-project-automation github-project-automation bot moved this to Not Started/Backlog 📆 in WP Performance 2024 Nov 21, 2024
@westonruter westonruter added Needs Dev Anything that requires development (e.g. a pull request) Good First Issue Issue particularly suitable to be worked on by new contributors labels Nov 26, 2024
@westonruter westonruter moved this from Not Started/Backlog 📆 to To Do 🔧 in WP Performance 2024 Nov 26, 2024
@westonruter
Copy link
Member Author

westonruter commented Nov 29, 2024

This may end up being important for Speculative Loading as well (h/t @yoavweiss):

Looks like Chromium is about to change how prefetches behave, so that only cacheable resources will be served from the prefetch cache: https://groups.google.com/a/chromium.org/g/blink-dev/c/Zdo71C0k9C0/m/BRXW6aQiAAAJ

If you're prefetching your HTMLs, make sure they are actually cacheable, even with a short lifetime.

@gilbertococchi
Copy link

That's an interesting insight, +1.

Also, if a WP Site uses Speculation Rules Prefetch or Prerender having BFCache working is particularly important in case of following back/forward navigations.

Speculation Rules is an API that works really well in combination with BFCache (not being blocked) and/or Cross Document View Transition.

@westonruter
Copy link
Member Author

This may make sense to propose as part of the core merge for Speculative Loading since it if the Cache-Control header prevents Speculation Rules from working, then having the feature enabled in core would only wastefully increase server load without improving the user's navigation experience.

See Core-62503 and WordPress/wordpress-develop#7860.

cc @felixarntz

@westonruter westonruter changed the title Use of Cache-Control: no-store should be flagged by Site Health for unauthenticated frontend responses Use of Cache-Control: no-store, no-cache, max-age=0 should be flagged by Site Health for unauthenticated frontend responses Nov 29, 2024
@westonruter
Copy link
Member Author

westonruter commented Nov 29, 2024

Speculative Loading should also then be disabled automatically when a user is logged-in.

@westonruter
Copy link
Member Author

Speculative Loading should also then be disabled automatically when a user is logged-in.

I've filed this as #1709.

@westonruter westonruter removed the Good First Issue Issue particularly suitable to be worked on by new contributors label Nov 29, 2024
@westonruter westonruter moved this from To Do 🔧 to Definition ✏️ in WP Performance 2024 Nov 29, 2024
@westonruter westonruter removed the Needs Dev Anything that requires development (e.g. a pull request) label Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Performance Lab Issue relates to work in the Performance Lab Plugin only [Type] Enhancement A suggestion for improvement of an existing feature
Projects
Status: Definition ✏️
Development

No branches or pull requests

2 participants