JK Docs
Tools

Cache Busting: Force Browsers & Cloudflare to Reload Assets

Last updated: 4/20/2026

Why Assets Don't Update

When you replace a file with the same name, three caches may serve the old version:

  1. Browser cache — Your local machine's stored copy
  2. Cloudflare CDN — Copies on global Cloudflare servers
  3. Server cache — Less common for static files

Method 1: Hard Refresh (Browser Only)

  • Mac: Cmd + Shift + R
  • Windows/Linux: Ctrl + F5

Test in Private/Incognito window first — no cache is read.

Method 2: Purge Cloudflare Cache

If the asset is new on the server but Cloudflare serves the old one:

  1. Cloudflare dashboard → your domain
  2. Caching → Configuration
  3. Purge Everything

Method 3: Cache Busting in Code

Add a version query parameter so browsers treat it as a new file:

<!-- Gets cached indefinitely --> <img src="assets/images/banner.jpg"> <!-- Forces browser to download new version --> <img src="assets/images/banner.jpg?v=2">

In PHP, use the file modification time automatically:

$version = filemtime('assets/images/banner.jpg'); echo '<img src="assets/images/banner.jpg?v=' . $version . '">';

Method 4: Rename the File

The most reliable method ever:

hero-bg.jpg → hero-bg-v2.jpg

No cache issues possible. Update the reference in code and commit.

Method 5: Verify Server Has Latest Code

If using Coolify auto-deploy:

  1. Coolify → project → Deployments tab
  2. Confirm latest deployment completed
  3. If not, manually click Deploy
JK Docs
New Guide

Categories

DevOpsBackendFrontendDatabaseToolsSecurityDesignSystem Admin
Admin Panel