How to instruct CloudFlare to disable all cacheing for my index.html page

  • Disable browser cache completely
  • Disable all CloudFlare internal cacheing

My index page is very small and uses cachebusting

I’ve set a page rule to bypass the cache for ‘/’, and nothing seems to work. I want CloudFlare to guarantee that my index.html page will never be cached anywhere

Ty for any help!

Can you post the full syntax of your page rule please?

You culd also set cache control headers

PHP example:

header("Content-Type: text/html; charset=utf-8");
header("Expires: Sun, 01 Jan 2014 00:00:00 GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0");
header("Pragma: no-cache");

and set your page rule to “Respect Existing Headers”.

I’m not sure how to copy the full syntax but I set the matching url to “[my domain]/” and the “Cache Level” to “Bypass”

I’m going to try setting the headers like you said now

So CloudFlare is trying to cache the index page even though I have it set to “Bypass” How can I ask CloudFlare not to cache a specific assets like the index.html

Cloudflare doesn’t cache html by default. So unless you set a page rule explicitly telling us to cache… we’re not. What makes you think Cloudflare is trying to cache the page?

So until I purge the entire CloudFlare cache, my page doesn’t update. Even if I clear my browser cache, I still don’t see the update until I purge the CloudFlare cache. I did not set up any rule myself to cache any html page. Most of my settings are default.

Do you have any page rules configured?

Just the page rule I mentioned above and one to redirect www → non www

Cloudflare isn’t caching the page though. Looking at the http headers returned for the site you’ve purged repeatedly in the audit logs the main page returns a cache status of DYNAMIC which means it a. isn’t considered for caching and b. isn’t (see a).

301 or 404 responses? Yes we cache those by default unless you send a specific cache control header to the contrary but the main page? Definitely not.

Is the /favicon-16x16.1061b7d5.png being cached? Yes. If you don’t want static assets to be cached you’d want to add a /* or other pattern to you first page rule as appropriate.

But the main page? Not being cached by Cloudflare.

  1. So when I bypass cloudflare and visit my server directly there is no cacheing issue.
  2. Clearing the browser cache doesn’t resolve the issue. Only purging the cloudflare cache does.

What can this mean…?

I will do some research on my cache busting hashes. They’re supposed to be unique

I apologize, this ended up being a problem with the build tool I was using.

Basically the build tool wasn’t altering file hashes when a dependency was changed.

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