Duarte Calha



Question 5

Subject: Content not Being Cached

After activating Cloudflare on my site, I am seeing that resources on my pages are not being cached:

* 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

--------------------------------------------------------------------------------------------------------------------------------------------

Thank you for reaching out about the caching issues you’re experiencing with Cloudflare. From the information you’ve provided, it looks like the `Cache-Control` headers are instructing browsers and Cloudflare not to cache the content. Here are some steps to troubleshoot and resolve the issue:

  1. Review Cache-Control Headers: The `Cache-Control` header in the response is set to `no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0`. This configuration tells Cloudflare and browsers not to cache the content. You should adjust these headers on your origin server to allow caching. For example, use `Cache-Control: public, max-age=3600` to cache the content for one hour.
  2. Check Page Rules: Log in to your Cloudflare dashboard and review your Page Rules. Ensure that there are no Page Rules that override default caching settings or disable caching for specific URLs.
  3. Verify Caching Level: In the Cloudflare dashboard, navigate to the Caching settings and check the Caching Level. Set it to "Standard" if it’s set to "No Query String" or "Ignore Query String" which could affect how content is cached.
  4. Clear Cloudflare Cache: Sometimes, old cache settings may persist. Go to the Cloudflare dashboard and purge the cache to ensure that new caching rules take effect.
  5. Examine Origin Server Settings: Ensure that your origin server’s caching settings are compatible with Cloudflare’s caching. Incorrect configurations on your origin server can impact how Cloudflare caches content.

If these steps do not resolve the issue, please provide additional details about your caching configuration, and I’ll be happy to assist further.