Subject: Content not Being Cached
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,
Thank you for reaching out!
The reason Cloudflare is not caching your content is because your origin server is sending HTTP headers that instruct clients and proxies not to cache the content. Specifically, the Cache-Control: no-store, no-cache, must-revalidate header tells Cloudflare and browsers to bypass caching and always fetch a fresh copy from your server.
To enable Cloudflare caching for your site, you can do one or more of the following:
Cache-Control or Expires headers on your origin server to allow caching.Once the headers and/or page rules are configured, Cloudflare will cache your resources according to the specified rules.
Best regards,
Lejla Vejzović | Cloudflare Support
To troubleshoot this issue, I analyzed the HTTP response headers using curl -svo /dev/null to see how the origin server instructs caching. I referenced Cloudflare caching documentation to confirm how Cloudflare respects origin headers and page rules. The solution focuses on correcting the headers or creating Cloudflare page rules to enable caching for the desired content.