X-Cache
X-Cache is a non-standard (custom) HTTP response header commonly added by CDNs, reverse proxies, and caching layers to indicate what the cache did with your request. Itβs mainly a debugging/observability header: it helps you confirm whether a response was served from cache, forwarded to the origin, or revalidated.
Because X-Cache is not defined by an official RFC, its exact values and meaning vary across providers. Always interpret it in the context of the specific CDN/proxy you are using. Your application controls caching primarily with standard headers such as:
Cache-ControlETagLast-ModifiedVaryExpires
But those headers donβt directly tell you what actually happened in the CDN/proxy. X-Cache is often used to answer questions like:
- βDid the response come from the CDN cache?β
- βWas it a cache miss that went to the origin?β
- βWas the object stale and revalidated?β
- βWhich cache node served it?β
HITβ
The response was served from cache without contacting the origin.
x-cache: Hit from cloudfront
MISSβ
The cache did not have a stored response (or could not use it), so it forwarded the request to the origin.
x-cache: Miss from cloudfront
BYPASSβ
The cache intentionally skipped caching (e.g., because of cookies, authorization, cache rules, or explicit directives).
EXPIRED / STALEβ
The cache had an entry, but it was stale (expired). Depending on rules, it may revalidate or refetch.
REVALIDATEDβ
The cache checked with the origin (often using ETag / Last-Modified) and could reuse the cached body.