Is this page coming from the Cloudflare cache? Reading cf-cache-status and purging one address

Speed, Cache & CDN·· 101 views· 3 min read

The short answer: every response that goes through Cloudflare carries a header, cf-cache-status, that says whether it came from the copy stored at Cloudflare or from the server. You read it in the browser or with a command. Once you know, you stop guessing: you purge only the address that changed, instead of emptying the whole cache, and you notice when stale content is not coming from Cloudflare at all.

The values you will see

Value What it means
HIT Served from Cloudflare’s copy. The server was not even asked.
MISS There was no copy. It fetched from the server and, if it can, keeps it for next time.
EXPIRED There was a copy, but its lifetime had passed. It fetched a new one from the server.
REVALIDATED The expired copy was confirmed with the server as still valid, and served.
BYPASS The server or a rule said not to store this response, for example with a header marking it private.
DYNAMIC Cloudflare does not consider this content for caching. According to its documentation, that is normal for HTML pages when no rule says otherwise.
The header is missing The request did not go through Cloudflare: the name is grey, or the DNS still points at the server. See orange cloud or grey cloud.

Checking the status and purging only what changed

1 In the browser: open the developer tools (F12), Network tab, reload the page, click the request you care about and look for cf-cache-status in the response headers.
2 Or in a terminal, with the command below and the full address of the file or page. The cf-cache-status line appears among the headers.
3 If it says HIT and the content is stale, purge that address: in the Cloudflare dashboard, in the caching section, use Custom Purge and paste the full address, exactly as the visitor requests it.
4 Purge every variant that exists: with and without www, and the same file with different parameters (for example ?ver=) are separate entries in the cache.
5 Ask again with the command: the first answer should say MISS or EXPIRED, and the next one HIT. If the browser still shows the old version, the copy is in the browser or the site’s own cache, not at Cloudflare.
6 Keep Purge Everything for when a lot has changed. Afterwards, every request goes to the server until the cache fills up again.

curl -sI https://www.yourdomain/path/to/file.css

DYNAMIC or BYPASS on a page with stale content means Cloudflare is not to blame. It did not store that response. Look in the site’s cache, for example the WordPress caching plugin (LiteSpeed Cache for WordPress), and in the browser’s, with a private window.
For files that change (CSS, JavaScript, the logo), rename them or add a version instead of purging on every edit: a new address is never in the cache. See versioned file names and cache busting.

Cloudflare still serving the old version after purging? Send us the address and what the command showed.

Open a support ticket

SEE ALSO

Cloudflare: when it helps, how to switch it on, and the cache that fools you

Cache rules for a WordPress site, without hiding the dashboard

Visitors still see the old CSS or logo: versioned file names and cache busting

Site with a CDN or without: how to test whether it made a difference

LiteSpeed Cache for WordPress: the first settings

Switching the CDN off, and confirming it really is off

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from $6.60/mo (3-year plan, with coupon)

See plans
Was this answer helpful? Your answer helps us improve this article.