A nasty edge case for No-Vary-Search

This concerns the intersection of cache invalidation and naming things, so
it's no wonder it's hairy. I haven't yet caught any off-by-one errors in
its implementations, but this seems dramatically required for the next act.

Suppose a cache has a stale entry,

GET /?a=1

200 OK
No-Vary-Search: param=("a")
ETag: "xyz"

A client makes an unconditional request for /?a=2.

The cache might try revalidating with

GET /?a=1
If-None-Match: "xyz"

or

GET /?a=2
If-None-Match: "xyz"

or

GET /
If-None-Match: "xyz"

These all seem to be valid implementation decisions and I see no reason to
express a preference. But in any of these cases, suppose the origin
responds,

304 Not Modified
No-Vary-Search: param=("b")
ETag: "xyz"

thereby breaking the equivalence relation between the stored /?a=1 and the
requested /?a=2.

No matter which request was made, the conclusion must be the same: the
content cached under the "xyz" ETag is no longer scoped to the same
resource as the one that the client requested. The 304 response leaves the
cache with insufficient information to satisfy the client's request. The
only correct course of action is for the cache to retry to the origin with
an unconditional request.

The following is derived from AI research that I have not yet independently
verified: neither Chromium nor Gecko currently handles this correctly.
Chromium will revalidate with /?a=1, while Gecko will revalidate with
/?a=2, but neither one will make the required retry. Both will respond to
the client with an entity that no longer matches what the client requested.
Gecko last month added a unit test test_304_changing_the_rule_updates_the_index
which specifically asserts incorrect behavior.

Received on Sunday, 27 September 2026 15:26:19 UTC