X-Cache-Hits
The HTTP X-Cache-Hits response header is an unofficial HTTP header reporting the number of times a cached resource has been served from each cache layer in a CDN or caching proxy.
Note
The "X-" naming convention for HTTP headers, "X" referring to "experimental", has been deprecated and needs to be transitioned to the formal naming convention for HTTP headers.
Usage
The X-Cache-Hits header is set by CDN platforms and
caching proxies built on Varnish to expose how many times
a cached object has been served from a particular cache
node. The value comes from the Varnish obj.hits counter,
which tracks how many requests a stored object has
fulfilled since being cached.
A single numeric value represents a single cache layer. When a CDN uses multi-tier Caching with shield and edge nodes, the header contains comma-separated values where each position corresponds to a cache tier. The first value is typically the shield node (closest to the origin) and the last value is the edge node (closest to the end user). This ordering matches the pattern used by X-Served-By and X-Cache.
A value of 0 at any position means the resource was a
cache miss at the tier. A positive number means the
resource was served from cache and indicates how many
times the particular node has served the object. Hit
counts are tracked independently on each cache server,
so values are per-node rather than aggregate totals.
Values
Single value
A single integer indicates one cache layer processed the
request. 0 means a miss. Any positive number means a
cache hit and reflects the hit count on the node.
Comma-separated values
Multiple comma-separated integers indicate the request passed through multiple cache tiers. Each position maps to a node in the delivery chain, ordered from origin-side to client-side.
Example
A value of 0 means the resource was not found in cache.
The request was forwarded to the origin server to fetch
a fresh copy.
X-Cache-Hits: 0
A value of 3 means the cached object has been served
three times from this cache node since being stored. The
response came directly from cache without contacting the
origin server.
X-Cache-Hits: 3
Comma-separated values show hit counts across multiple
cache tiers. Here, 0, 0 means the resource was a miss
at both the shield node and the edge node. This is
typical for the first request to a resource or after a
cache purge.
X-Cache-Hits: 0, 0
In this three-tier example, the shield missed (0), the
mid-tier cache had served the object once before (1),
and the edge node missed (0). The edge node fetched the
response from the mid-tier cache.
X-Cache-Hits: 0, 1, 0
Pairing X-Cache-Hits with X-Cache and X-Served-By gives a complete picture of cache behavior across all tiers. The hit count confirms how warm each cache node is for a given resource.
X-Served-By: cache-lga21984-LGA, cache-pdx12334-PDX
X-Cache: MISS, HIT
X-Cache-Hits: 0, 1
Takeaway
The X-Cache-Hits header reports per-node cache hit counts across each tier in a CDN delivery chain. The values help distinguish first-time misses from warm cache nodes and provide visibility into multi-tier caching behavior.