Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Prevent cache in CloudFlare

I'm getting started with CloudFlare and I’m using it to build a new project.

I’m facing an issue when I make changes: I cannot see my changes in the browser, so I assume the problem here is the cache setting of CloudFlare.

I have read this link, about the CloudFlare cache, so I put the following meta-tag in my html:

<meta http-equiv="Cache-control" content="private">

But the problem still remain.

Should I put other meta-tags, or prevent -somehow- caching from the server-side? (I'm using PHP)

like image 472
Tomás Juárez Avatar asked Mar 21 '13 04:03

Tomás Juárez


People also ask

How do I stop Cloudflare caching?

To deactivate the Cloudflare full-page caching, simply go to the Cloudflare Tab, click Deauthenticate, and after that disable the optimization. This will remove the SiteGround Optimizer Worker that was added to your account. By doing this you will revert to the default settings of your Cloudflare account.

How do I tell Cloudflare to not cache?

When using Origin Cache-Control and setting max-age=0 , Cloudflare prefers to cache and revalidate. With Origin Cache-Control off and max-age=0 , Cloudflare settings bypass cache. Setting no-cache also bypasses cache.

Does Cloudflare automatically cache?

Cloudflare does not cache HTML resources automatically. This prevents us from unintentionally caching pages that often contain dynamic elements. For example, the content on certain HTML pages may change based on specific visitor characteristics, such as authentication, personalization, and shopping cart information.


1 Answers

cloudflare has a Development mode option that:

  • Changes to cacheable content (like images, CSS, or JavaScript) will be visible immediately.
  • CloudFlare's accelerated cache will be disabled.
  • Development mode will automatically toggle off after 3 hours.
  • If changes to your site are not immediate, press shift-reload.

You will also be able to turn off the Development mode at any time during the 3 hours.

Hope this helps with people looking for the same answer to this question or if you still have this issue.

like image 173
JohnAAndrew Avatar answered Sep 25 '22 02:09

JohnAAndrew