How to Purge and Invalidate a CDN Cache Correctly
31/07/2026
A CDN speeds up your site by storing copies of files on servers around the world and serving them from the nearest edge. Trouble starts when you change a file: visitors keep getting the old, cached version until it expires. Purge and cache invalidation solve exactly that — they tell the CDN to forget the old copy.
Purge versus expiry (TTL)
Every cached file has a TTL — how long it is kept before the CDN asks the origin again. If the TTL is one hour, a change propagates on its own within an hour at most. Purge speeds that up to seconds: manually or via API you tell the CDN to drop the copy now. Understanding TTL and caching is easier with our explanation of caching and edge caching.
Three approaches to invalidation
- Purge everything — fastest for rare, large changes (a redesign). Downside: your cache hit ratio drops temporarily because everything must be re-cached.
- Purge by URL or tag — precisely clear only the changed pages. The best balance for daily work.
- File versioning — add a hash to the file name (style.a1b2.css). A new version means a new URL, so no purge is needed. Ideal for CSS, JS and images.
A practical rule
For HTML pages use short TTLs and purge by URL; for static assets (CSS, JS, images) use long TTLs and versioning. That way text edits appear instantly while files stay maximally cached. Our SEO hosting plans include a global CDN with purge control, and the full feature list is on the plans page.
Frequently asked questions
Does purging slow the site down? Briefly, yes, because the first requests go back to the origin. So purge selectively, not everything at once.
Why do I still see the old version after a purge? Usually the browser cache or an on-site caching plugin is to blame — clear those too.