-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Site Health: Add common cache headers for improved caching diagnostics #10598
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
Site Health: Add common cache headers for improved caching diagnostics #10598
Conversation
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
westonruter
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. I'd like to get a second opinion on these headers.
dmsnell
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Being part of the site health dashboard this seems rather benign to add. I wish that the $cache_hit_callback were more robust than it is, since it also matches on values like “this cache is *hit, don’t use it” and “not a hit” but that’s not part of this ticket or work.
would be awesome to have some example strings from each of these new headers as a comment to the right of them.
for example, the varnish docs suggest that the full match is hit, meaning we could add => static function ( $v ) { return 'hit' === $v; } /** @see https://www.varnish-software.com/developers/tutorials/logging-cache-hits-misses-varnish/ */
the extra examples are icing on the cake and not necessary here.
according to this random survey x-cache-status is expected to only contain hit, though for x-cache there is an insignificant but measureable count of requests containing HIT, MISS
I've filed this as Core-64370. |
Developed in #10598 Follow-up to [54043]. Props akshat2802, szepeviktor, dmsnell, vincentbreton, dannythedog, westonruter. See #56041. Fixes #63748. git-svn-id: https://develop.svn.wordpress.org/trunk@61355 602fd350-edb4-49c9-b593-d223f7449a82
Developed in WordPress/wordpress-develop#10598 Follow-up to [54043]. Props akshat2802, szepeviktor, dmsnell, vincentbreton, dannythedog, westonruter. See #56041. Fixes #63748. Built from https://develop.svn.wordpress.org/trunk@61355 git-svn-id: http://core.svn.wordpress.org/trunk@60667 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Developed in WordPress/wordpress-develop#10598 Follow-up to [54043]. Props akshat2802, szepeviktor, dmsnell, vincentbreton, dannythedog, westonruter. See #56041. Fixes #63748. Built from https://develop.svn.wordpress.org/trunk@61355 git-svn-id: https://core.svn.wordpress.org/trunk@60667 1a063a9b-81f0-0310-95a4-ce76da25c4cd
Trac ticket: https://core.trac.wordpress.org/ticket/63748
This PR adds support for detecting common server-level cache headers in the Site Health page cache test, improving accuracy for sites using Nginx FastCGI cache, Varnish, LiteSpeed, Cloudflare CDN, and other widely-deployed caching solutions.
This extends the get_page_cache_headers() method to include the following commonly-used cache headers:
Added Headers: