Skip to content

Conversation

@AKSHAT2802
Copy link

@AKSHAT2802 AKSHAT2802 commented Dec 4, 2025

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:

  • x-cache - Generic cache status header used by Varnish, Apache mod_cache, Nginx, and many CDN providers
  • x-cache-status - Most common convention for Nginx FastCGI cache (using $upstream_cache_status variable)
  • x-litespeed-cache - LiteSpeed Web Server and LiteSpeed Cache plugin
  • x-proxy-cache - Generic reverse proxy cache indicator
  • cf-cache-status - Cloudflare CDN cache status (automatically added by Cloudflare)
  • via - Standard HTTP header indicating proxy/intermediary presence (RFC 9110)

@github-actions
Copy link

github-actions bot commented Dec 4, 2025

Test using WordPress Playground

The 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

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

@AKSHAT2802 AKSHAT2802 marked this pull request as ready for review December 5, 2025 19:01
@github-actions
Copy link

github-actions bot commented Dec 5, 2025

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props akshat2802, westonruter, szepeviktor, dmsnell.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Member

@westonruter westonruter left a 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.

Copy link
Member

@dmsnell dmsnell left a 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

@westonruter
Copy link
Member

the extra examples are icing on the cake and not necessary here.

I've filed this as Core-64370.

pento pushed a commit that referenced this pull request Dec 6, 2025
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
@github-actions
Copy link

github-actions bot commented Dec 6, 2025

A commit was made that fixes the Trac ticket referenced in the description of this pull request.

SVN changeset: 61355
GitHub commit: df52bf2

This PR will be closed, but please confirm the accuracy of this and reopen if there is more work to be done.

@github-actions github-actions bot closed this Dec 6, 2025
markjaquith pushed a commit to markjaquith/WordPress that referenced this pull request Dec 6, 2025
github-actions bot pushed a commit to gilzow/wordpress-performance that referenced this pull request Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants