X-Cache

The HTTP X-Cache response header is an unofficial header indicating whether a CDN or caching proxy served the response from cache or fetched the content from the origin server.

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 header is added by CDN providers and caching proxies to signal cache status. When a request reaches a cache node, the node checks its stored content. If a fresh copy exists, the response is served directly from cache and marked as a HIT. If no cached copy is available, the node fetches the content from the origin server and marks the response as a MISS.

This header is not part of the official HTTP specification. CDN providers such as AWS CloudFront, Fastly, Varnish, Akamai, and Azure CDN all use the X-Cache header, though the exact values and formatting differ between providers. Cloudflare uses a separate Cf-Cache-Status header for the same purpose.

Values

HIT

The HIT value means the response was served from the cache without contacting the origin server.

MISS

The MISS value means the cache did not have a stored copy and the response was fetched from the origin server. The content is typically cached for subsequent requests after a MISS.

BYPASS

The BYPASS value means the cache was intentionally skipped. This happens for uncacheable content such as dynamic responses or requests with specific Cache-Control directives.

EXPIRED

The EXPIRED value means the cached entry had passed its freshness lifetime and was revalidated with the origin server.

STALE

The STALE value means an outdated cached copy was served while the cache refreshes the content in the background.

REVALIDATED

The REVALIDATED value means a stale cache entry was confirmed as still valid by the origin server and served to the client.

Example

AWS CloudFront includes a descriptive format with the provider name. Hit from cloudfront means the resource was served from the CloudFront cache. Miss from cloudfront means no cached copy existed and the response was fetched from the origin server.

X-Cache: Hit from cloudfront
X-Cache: Miss from cloudfront

Fastly, Varnish, and other caching proxies use a shorter format. HIT and MISS carry the same meaning as above.

X-Cache: HIT
X-Cache: MISS

Many CDN setups have multiple cache layers: a local edge node close to the visitor and a regional shield cache closer to the origin. When both values are MISS, the resource was not found at either layer, and the origin server fulfilled the request.

X-Cache: MISS, MISS

Three comma-separated values represent three cache tiers. In this example, the first tier missed, the second tier had a cached copy, and the third tier (edge) still had to fetch from the previous tier. This pattern is common in multi-tier CDN architectures.

X-Cache: MISS, HIT, MISS

Some CDN configurations append a counter after HIT, showing how many times the cached entry has been served since being stored. A value of 2 means the cached resource has been served twice.

X-Cache: HIT: 2

Takeaway

The X-Cache response header is a widely adopted, non-standard header used by CDN providers and caching proxies to report whether a response was served from cache or retrieved from the origin server.

See also

Last updated: March 6, 2026