Problem with CloudFlare HTML caching

Recently, my website seems not served the newest HTML content in both static and dynamic page (PHP).
More detail:

  • If I make changes to an HTML file, and refresh it in the browser, nothing changes, the old content still there, and you have to refresh one more time or even more to have the newest version.
  • If I have just logged in to my website and it’s said I still not logged in until refresh the page again.

My Cloudflare settings:
Caching:

  • Caching Level: standard
  • Browser Cache Expiration: 8 days
  • Always Online™: on
    Speed:
  • Auto Minify: HTML, CSS, JS
  • Brotli: on
  • Rocket Loader: off
  • Enable Accelerated Mobile Links: on
  • Polish and Railgun: off

Based on your settings listed above Cloudflare wouldn’t be caching HTML content. You might check either your cache header being sent with the html page and/or the caching layer on your origin.

1 Like

Hi there,
Here is my cache header when access an HTML page, the max-age seem be the problem?
Response Header:
Cache-Control: max-age=259200
CF-RAY: 40a5cd45622a3397-HKG
Connection: keep-alive
Date: Thu, 12 Apr 2018 12:47:30 GMT
ETag: “5a77dd65-1879”
Expires: Sun, 15 Apr 2018 12:47:30 GMT
Last-Modified: Mon, 05 Feb 2018 04:28:21 GMT
Server: Cloudflare
Request Headers
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8
Accept-Encoding: gzip, deflate
Cache-Control: max-age=0
Connection: keep-alive
DNT: 1
If-Modified-Since: Mon, 05 Feb 2018 04:28:21 GMT
Upgrade-Insecure-Requests: 1

I believe so… if Cloudflare were caching the content we would add a cf-cache-status header. Although oddly you have 2 cache-control headers… I have no idea how a browser would interpret that.

1 Like

Hi there,
Thanks for your quick reply. I am so sorry, that was my mistake. I have just edited my post, would you mind checking it again, thanks again.

This topic was automatically closed after 14 days. New replies are no longer allowed.