HTTP headers for cache inspection

Multiple HTTP headers can be used to monitor when a page is loaded from the cache and when the cache expires. For example

HTTP header names are case-insenitive.

Age is the same HTTP header as age or AGE.

The age header

The age header is a generic HTTP response header.

It reports the time, in seconds, the requested object was in a proxy cache.

The age header is generally calculated as the difference between the time and date reported by the proxy server and the value provided by the Date header included in the HTTP response.

The cf-cache-status header

The cf-cache-status header is a Cloudflare-specific header. It is available when a site uses Cloudflare as part of its hosting and serving infrastructure.

The Cloudflare cache status header is fully-documented in the Cloudflare Docs at Cloudfare cache responses.

The table below sets out what each output value signifies in terms of whether or not a page is being served from the Cloudflare cache or not.

Applicability to Matrix-developed sites varies

The cf-cache-status header indicates the status of the referenced page. It does not indicate the cache status of the page’s components.

As well, not all of the cf-cache-status values will be seen. For example, because Matrix handles Stale While Revalidate itself, the cd-cache-status will never be STALE on a Matrix-managed site.

Table 1. Cloudflare cache status output
Output Cacheable? Cached? Expired? Refreshed? Served from?

HIT

Yes

Yes

No

No

Cloudflare

MISS

Yes

No

No

No

Origin

NONE

No

No

No

No

Origin

UNKNOWN

No

No

No

No

Origin

EXPIRED

Yes

Yes

Yes

Yes

Origin

STALE

Yes

Yes

Yes

No

Origin

BYPASS

No

No

No

No

Origin

REVALIDATED

Yes

Yes

No

Yes

Cloudflare

UPDATING

Yes

Yes

Yes

No

Cloudflare

DYNAMIC

No

No

No

No

Origin

This second table provides basic information about what each possible value for cf-cache-status means.

Table 2. Basic meaning of Cloudflare cache status output
Output Meaning

HIT

The object was found in and served from Cloudflare’s cache.

MISS

The object was not found in Cloudflare’s cache. The object was, consequently, served from the originating web-server.

NONE or UNKNOWN

The object is not eligible for caching.

EXPIRED

The object was found in Cloudflare’s cache but was also expired. The object was, consequently, served from the originating web-server.

STALE

The object was found in Cloudflare’s cache and was also expired. Cloudflare could not, however, contact the originating resource. Consequently, the object was served from Cloudflare’s cache despite being expired.

BYPASS

The object has a Cache-Control header set with a value of no-cache, private, or max-age=0.

REVALIDATED

The object was found in Cloudflare’s cache but was stale. The resource was revalidated because either an If-Modified-Since or If-None-Match header was set. After revalidation it was served from Cloudflare’s cache.

UPDATING

The object was found in Cloudflare’s cache but was also expired. The originating web-server was updating the resource, however. Consequently, the object was served from Cloudflare’s cache despite being expired.

DYNAMIC

The object is not eligible for caching by Cloudflare and no explicit instruction exists to cache it. The object was, consequently, served from the originating web-server.

To use these headers to monitor cache status, first configure the Developer Tools included in a desktop web browser.