Cloudflare CDN caching guide
Cloudflare · reviewed against the vendor documentation listed below
How Cloudflare caches: cf-cache-status values, Cache Rules for HTML, purge versus invalidate, Tiered Cache and what each means for cache warming.
Part of the Top 10 CDNs in 2026 comparison. New to the topic? Start with why cache warming matters.
Caching at a glance
- Cache status on the response
cf-cache-statuson every cacheable response:HIT,MISS,EXPIRED,STALE,BYPASS,REVALIDATED,UPDATINGorDYNAMIC(logged as none/unknown when no cache status applies).- TTL controls
Cloudflare-CDN-Cache-Controltakes precedence overCDN-Cache-Control, which takes precedence overCache-Control. Cache Rules can set the Edge TTL and mark responses as eligible for cache.- Purge
- Purge by single file (URL), hostname, cache tag, prefix or everything. Invalidate marks content stale instead of removing it, and Cloudflare revalidates it on the next request.
- Tiering and origin protection
- Tiered Cache sends a miss to an upper-tier data center before the origin, and Smart Topology picks that upper tier for you. Generic Global, Regional and Custom topologies change which data centers act as upper tiers. Cache Reserve, built on R2, keeps cached objects longer.
- Edge compute
- Cloudflare Workers can read and write the cache from code.
Strengths for caching
- The richest per-response cache state of the CDNs we reviewed:
UPDATINGtells you a stale copy was served while Cloudflare refreshed it in the background. - Purge by tag, prefix and hostname, and an invalidate option that keeps a stale copy to revalidate instead of deleting it.
- Request collapsing through a cache lock: concurrent misses for the same asset in one data center send one request to the origin.
stale-while-revalidateis served asynchronously, andstale-if-errorapplies when the origin returns 500, 502, 503 or 504.
Watch-outs
- HTML and JSON are not cached by default; caching is decided by file extension. A Cache Rule with "Eligible for cache" is needed before there is anything to warm.
stale-while-revalidateandstale-if-errorare ignored when Always Online is enabled.- Without Tiered Cache, each data center fills from the origin on its own.
Cache warming on Cloudflare
Cloudflare caches per data center. A request warms the data center that served it, and with Tiered Cache it also fills an upper tier that other data centers can fill from before going to the origin. That makes Tiered Cache the setting that matters most for cache warming on Cloudflare: one warm upper tier shortens every other data center's cold start.
Check that pages are cacheable at all before warming them. With default settings an HTML page returns DYNAMIC, which means Cloudflare did not consider it for caching; warming it does nothing. Add a Cache Rule for the paths you want cached, then confirm a second request returns HIT.
curl -sI https://example.com/pricing | grep -i '^cf-cache-status'
# first request after a purge: cf-cache-status: MISS
# second request, same PoP: cf-cache-status: HITAfter a deploy, prefer invalidate (mark stale) over purge when the origin supports ETag or Last-Modified: Cloudflare revalidates the copy and reuses it when it has not changed, which avoids a full cold cache. See the Top 10 CDNs comparison for how this compares with other CDNs.
Frequently asked questions
Does Cloudflare cache HTML by default?
No. By default Cloudflare caches by file extension and does not cache HTML or JSON. A Cache Rule that sets the response as eligible for cache makes HTML cacheable.
What does cf-cache-status: DYNAMIC mean?
Cloudflare did not consider the response for caching, usually because of its file type or a rule. Warming a DYNAMIC URL does not fill the cache.
Does Tiered Cache change how I warm Cloudflare?
Yes. With Tiered Cache a miss at an edge data center is first sent to an upper tier, so a warmed upper tier can answer misses from several edge locations without going to the origin.
Related terms
Cloudflare documentation
- Cloudflare: Cloudflare cache responseshttps://developers.cloudflare.com/cache/concepts/cache-responses/
- Cloudflare: Default cache behaviorhttps://developers.cloudflare.com/cache/concepts/default-cache-behavior/
- Cloudflare: Cache Rules settingshttps://developers.cloudflare.com/cache/how-to/cache-rules/settings/
- Cloudflare: Origin Cache Controlhttps://developers.cloudflare.com/cache/concepts/cache-control/
- Cloudflare: CDN-Cache-Controlhttps://developers.cloudflare.com/cache/concepts/cdn-cache-control/
- Cloudflare: Purge cachehttps://developers.cloudflare.com/cache/how-to/purge-cache/
- Cloudflare: Tiered Cachehttps://developers.cloudflare.com/cache/how-to/tiered-cache/
- Cloudflare: Cache Reservehttps://developers.cloudflare.com/cache/advanced-configuration/cache-reserve/
Warm your cache after every deploy
sitewarm requests the pages in your sitemap after a deploy and reports the cache state the CDN returns for each one, with the vantage point it was measured from.