Customer Query: After activating Cloudflare on my site, I am seeing that resources on my pages are not being cached...
curl -svo /dev/null roskolniv.us
* Rebuilt URL to: roskolniv.us/
* Trying 104.16.27.128...
* Connected to roskolniv.us (127.0.0.1) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.40.0
> Host: roskolniv.us
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Mon, 22 Jun 2015 03:03:59 GMT
< Content-Type: text/html; charset=utf-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0
< Strict-Transport-Security: max-age=10
< X-Powered-By: Express
< Server: cloudflare-nginx
< CF-RAY: 1fa4b922fef517a4-SIN
<
{ [3507 bytes data]
* Connection #0 to host roskolniv.us left intact
Why is Cloudflare's caching not working on my site?
Hi there,
Thanks for sharing the curl output — it's super helpful, and I can see exactly why your content isn't being cached.
The culprit is your origin server's cache-control headers. Specifically, it's sending this:
"Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0"
These headers are telling both Cloudflare and browsers not to cache the content at all. Since Cloudflare respects origin cache headers by default, we're following those instructions and skipping the cache.
Here's how you can fix this:
You've got a few options depending on how much control you want:
For a deeper dive into how caching works with Cloudflare and the different options available, check out:
🔗 Cloudflare Cache Behavior Explained
Let me know which option feels right for you, and I'd be happy to walk you through the setup.
Best regards,
Aviv
Cloudflare Support
This question involves a technical analysis of HTTP headers to diagnose a caching issue. The curl output provided by the customer contains all the information needed to identify the problem.
Tools I would use to investigate this issue:
My approach is to first explain the cause of the issue clearly, then provide multiple solutions that vary in complexity and implementation method. This gives the customer options based on their technical comfort level and specific needs.