[wp-trac] [WordPress Trac] #64370: Response header detection in page cache test for Site Health should be more robust

WordPress Trac noreply at wordpress.org
Sat Dec 6 01:46:58 UTC 2025


#64370: Response header detection in page cache test for Site Health should be more
robust
-------------------------+--------------------------
 Reporter:  westonruter  |       Owner:  (none)
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  7.0
Component:  Site Health  |     Version:  6.1
 Severity:  normal       |  Resolution:
 Keywords:  needs-patch  |     Focuses:  performance
-------------------------+--------------------------
Description changed by westonruter:

Old description:

> This is a follow-up to #63748. See [https://github.com/WordPress
> /wordpress-develop/pull/10598#pullrequestreview-3546622057 PR comment]
> from @dmsnell:
>
> > 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 [https://www.varnish-software.com/developers/tutorials
> /logging-cache-hits-misses-varnish/ 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 [https://webtechsurvey.com/response-header/x-cache-status
> this random survey] `x-cache-status` is expected to only contain `hit`,
> though [https://webtechsurvey.com/response-header/x-cache for x-cache]
> there is an insignificant but measureable count of requests containing
> `HIT, MISS`

New description:

 This is a follow-up to #63748. See [https://github.com/WordPress
 /wordpress-develop/pull/10598#pullrequestreview-3546622057 PR comment]
 from @dmsnell:

 > 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 [https://www.varnish-software.com/developers/tutorials
 /logging-cache-hits-misses-varnish/ 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 [https://webtechsurvey.com/response-header/x-cache-status
 this random survey] `x-cache-status` is expected to only contain `hit`,
 though [https://webtechsurvey.com/response-header/x-cache for x-cache]
 there is an insignificant but measureable count of requests containing
 `HIT, MISS`

 Also, [https://wordpress.slack.com/archives/C02KGN5K076/p1764973573339019
 in Slack]:

 > the only thing that really caught my eye is that we’re needly allocating
 to do case-insensitive compare instead of calling `stripos()`

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/64370#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list