Question
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?
Answer:
Hello,
Sorry to hear that you are experiencing this issue.
Cloudflare does not cache the resource when the set-Cookie header exists, the Cache-Control header is set to private, no-store, no-cache, or max-age=0.
In your case, the header Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0 is present, which instructs Cloudflare not to cache the content.
Cloudflare does cache the resource when the Expires header is set to a future date, the Cache-Control header is set to public and max-age is greater than 0. To ensure that Cloudflare caches your resources, you need to adjust the caching headers.
Please refer to our Default Cache Behavior for more detailed information on Cloudflare’s caching behavior.
If you need any further assistance, please don't hesitate to reach out.
Best regards,
Ari Bovolente | Cloudflare Support
Thought Process:
First, I've checked Cloudflare's caching behavior and noticed that in the output of the command curl provided by the customer, some parameters are preventing caching. I've explained the problem and how to change the configuration to resolve the issue. For further reading, I've included a link to detailed documentation and reassured the customer that further assistance is available if needed.
Tools:
Documentation resources: For information about Cloudflare's caching behavior.
Browser Developer Tools: To inspect HTTP headers and verify the caching behavior in this case.
Curl Command: To check HTTP headers and responses from the origin server.