How does CloudFlare or CDNs in general work?

#1

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?

0 Likes

#2

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

#3

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.

0 Likes

closed #4

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

0 Likes