How does CloudFlare or CDNs in general work?

I would like to turn Cloudflare on for my WordPress server, but I’m still making changes very frequently. Cloudflare says that it caches static files (javascript, css, images, etc), so I’m assuming that if I made changes to these files and saved them on my servers, they would not show up changed on theirs (at least for a while).

If I make changes to these files, will they eventually propagate to their servers? How long does that take?

I’ve been doing the little trick of changing the src of my css files from “my.css” to “my.css?v=1.1” and “my.css?v=1.2” etc ttrockstars when I make changes so it forces your browser to get the newer version of the file because it is tricking it into thinking it’s a new file. Will this also work with Cloudflare, or does it bypass this?

By default, those files would be cached. So for now, you can Bypass Cache for your site with a Page Rule:

Match: example.com/*
Setting: Cache Level (Bypass)

For future reference, the Overview page of the Dashboard has a “Development Mode” for live changes. Then you’d Purge Cache (Everything) when you’re done and turn off Dev Mode (or it’ll turn off on its own in three hours).

1 Like

This is generally the best way to cache bust, and Cloudflare will re-download the file if there is a new query string as long as you haven’t set “ignore query string”.

If you want to avoid having to update the query string every time, definitely see @sdayman’s answer.

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