5. Content Not Being Cached on Cloudflare
Response
Hi! José Miguel from Cloudflare Support here.
When Cloudflare doesn't cache your content, it's usually because your origin server is sending response headers telling Cloudflare not to cache (like
Cache-Control: no-store, no-cache). These headers instruct both browsers and Cloudflare to avoid caching the content.
We can adjust these headers to allow caching or use Cloudflare's Cache Rules to override them and enable caching at the edge.
If you want Cloudflare to cache content regardless of the origin's headers, we can set up Cache Rules or use the
Cloudflare-CDN-Cache-Control header on your server.
Thought Process
The issue is the presence of restrictive caching headers (no-store, no-cache) on the origin response. This can be overridden through:
-
Cloudflare-CDN-Cache-Controlheader, which allows CDN-specific cache directives - Dashboard Cache Rules, where we can force caching even if the origin headers say otherwise
Diagnosing involves inspecting response headers using tools like curl -I or browser devtools network panel.
From there, applying cache rules or adjusting origin headers helps solve caching problems.
Tools I Would Use
- curl -I — To inspect HTTP response headers directly from the origin and Cloudflare edge
- Browser Developer Tools — To view network requests and response headers
- Cloudflare Dashboard — To review cache settings and create Cache Rules