Cache-Status

The grammar of the Cache-Status header Weir writes, and what every parameter and value means.

Every response carries a Cache-Status header in the RFC 9211 format. The member name is Weir; change it with Config.CacheStatus or drop the header with Config.NoCacheStatus.

Shape

Cache-Status: Weir; hit; ttl=43
Cache-Status: Weir; fwd=uri-miss; fwd-status=200; stored
Cache-Status: Weir; fwd=uri-miss; fwd-status=200; stored; collapsed
Cache-Status: Weir; hit; ttl=-10; detail=stale-while-revalidate
Cache-Status: Weir; hit; ttl=1; detail=negative

A response is either a hit with a ttl, or was forwarded with a fwd reason. collapsed and detail can follow either.

Parameters

ParameterMeaning
hitanswered from the store without waiting for the origin
ttl=Nseconds of freshness left. Negative on a stale hit: ttl=-10 is ten seconds past expiry
fwd=REASONthe origin was asked, and why (values below)
fwd-status=Nthe status the origin answered with
storedthe forwarded response was stored
collapsedthis request joined another request's fetch (coalescing)
detail=TEXTmore about the decision (values below)

fwd values

ValueThe origin was asked because
bypassa Bypass.Cookies or Bypass.Headers rule matched, or the engine is in bypass mode
methodthe method is not GET or HEAD
uri-missnothing is stored for this URL
vary-misssomething is stored for this URL, but not for these Vary header values
requestthe client asked for revalidation and Client.HonorRevalidation is on
stalethe stored entry was stale and had to be refetched or revalidated

detail values

On a stale hit, detail names why stale content was served:

ValueStale content was served because
stale-while-revalidateinside the SWR window; a background refresh is running
stale-if-errorthe origin failed and the entry is inside its SIE window
shedthe limiter shed this request
circuit-openthe breaker is open
coalesce-timeoutthis follower waited Coalesce.FollowerMaxWait for a slow flight

Other values: negative marks a negative-cache answer, and hit-for-miss marks a request sent to the origin without coalescing because this URL recently produced a response that could not be shared.

detail and fwd are free-text values that may gain members in a minor release. Parse them with a default case.

What is never in the header

The key parameter that RFC 9211 allows is never emitted (FR-SRV-9, T-27). A cache key in a response header tells an attacker exactly which inputs are keyed.

The value lists on this page are read from cachestatus.go at build time.