How long does the basic Cloudflare CDN cache things for?

I understand I can purge the cache myself, but I was wondering if I don’t how often Cloudflare CDN fetches a new version of the page or images. I have users updating images, but Cloudflare seems to serve the old versions for quite a while so I’m assuming thats the CDN cache?

Cloudflare will cache objects for as long as is specified in the cache-control response header your server sends. You can see more about this here:

You should utilize Cache Busting, where, when the file updates, you either change the file name or you add a random query string to the end (eg. ?id=2). Here’s the best guide I can find on the topic:

2 Likes

Along with Cache Busting, you can also automatically purge the cache of the file via the API https://api.Cloudflare.com/#zone-purge-files-by-url

2 Likes

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