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 As well, not all of the |
Output | Cacheable? | Cached? | Expired? | Refreshed? | Served from? |
---|---|---|---|---|---|
|
Yes |
Yes |
No |
No |
Cloudflare |
|
Yes |
No |
No |
No |
Origin |
|
No |
No |
No |
No |
Origin |
|
No |
No |
No |
No |
Origin |
|
Yes |
Yes |
Yes |
Yes |
Origin |
|
Yes |
Yes |
Yes |
No |
Origin |
|
No |
No |
No |
No |
Origin |
|
Yes |
Yes |
No |
Yes |
Cloudflare |
|
Yes |
Yes |
Yes |
No |
Cloudflare |
|
No |
No |
No |
No |
Origin |
This second table provides basic information about what each possible value for cf-cache-status
means.
Output | Meaning |
---|---|
|
The object was found in and served from Cloudflare’s cache. |
|
The object was not found in Cloudflare’s cache. The object was, consequently, served from the originating web-server. |
|
The object is not eligible for caching. |
|
The object was found in Cloudflare’s cache but was also expired. The object was, consequently, served from the originating web-server. |
|
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. |
|
The object has a |
|
The object was found in Cloudflare’s cache but was stale. The resource was revalidated because either an |
|
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. |
|
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.