Quick answer
Cache busting means changing a file's URL when its content changes, usually with a content hash in the file name or a version query string, so browsers and CDNs fetch the new version instead of reusing a cached copy. It is what makes very long cache lifetimes safe.
What is cache busting?
Cache busting is the practice of changing a file's URL when its content changes, so that browsers and CDNs fetch the new version instead of reusing the copy they already hold. The usual tools are a hash of the content in the file name, a version number in the path, or a query string such as ?v=42.
It exists because HTTP caching is keyed by address. Under RFC 9111 a cache stores a response against, at minimum, the request method and the target URI. While a stored copy is fresh, the cache may answer from it without asking the server. If you replace styles.css on the server but keep the name, a visitor holding a fresh copy never learns about it. There is no message you can send to every browser that says "drop that file". A new URL is the message: it is a key that no cache has seen.
Content-hash filenames vs query strings vs path versions
| Method | Example | What changes the URL | Strength | Risk |
|---|---|---|---|---|
| Content hash in the file name | app.3f9a1c.js | The file's own content | Only changed files get new URLs | Needs a build step that rewrites references |
| Version folder in the path | /v42/app.js | The release number | Simple, whole release stays consistent | Every file gets a new URL on every release |
| Date or sequence in the name | logo_2.png | A manual rename | Works without tooling | Easy to forget |
| Query string with a version | app.js?v=42 | The query value | No renaming of files | Some cache settings ignore the query string |
| Query string with a timestamp | app.js?t=1764720000 | Every request or build | Never stale | If set per request, nothing is ever reused |
The content hash is the most precise of these, because the name is derived from the bytes. Build tools do it for you; webpack, for instance, offers a [contenthash] placeholder that changes only when the content of an asset changes. Amazon's CloudFront guide likewise recommends version identifiers in file or folder names, so that you do not have to wait for objects to expire or pay for invalidations.
Query strings work when every cache on the way includes them in the key. That is a setting, not a guarantee. Cloudflare's default caching level delivers a different resource each time the query string changes, but its "Ignore Query String" level serves the same cached static file whatever follows the ?. CloudFront lets you choose whether query parameters are part of the cache key. Check your own configuration before you rely on ?v=.
How cache busting works with Cache-Control immutable
Cache busting is what makes a very long cache lifetime safe. For URLs that carry a fingerprint and never change content, web.dev's guidance is Cache-Control: max-age=31536000, one year. You can add immutable:
Cache-Control: public, max-age=31536000, immutable
RFC 8246 defines immutable as a promise that the server will not update that response during its freshness lifetime. Clients should then skip the conditional request they would otherwise send, for example when a visitor reloads, unless the visitor forces a reload. web.dev notes that some browsers ignore it.
The promise has one condition: you never publish different bytes under the same URL. Break it once and there is nothing to undo it with, because the browsers that hold the old copy have been told not to ask.
The HTML page is the other half. It is the file that lists the hashed names, and its own address does not change. Serve it with Cache-Control: no-cache, which allows storing it but requires checking with the server before each reuse. Vite's documentation makes the same point for single-page apps: without no-cache on the HTML, old assets are still referenced. The Cache-Control header guide lists a value for each file type.
Worked example: one release, five files
Sample data: a returning visitor has everything cached. A release changes only the application script. Sizes are transfer sizes.
| File | Size | Hashed names: re-downloaded? | One version number for all: re-downloaded? |
|---|---|---|---|
index.html | 30 KB | Yes (checked every time and changed) | Yes |
| Third-party library bundle | 400 KB | No | Yes |
| Application script | 120 KB | Yes | Yes |
| Stylesheet | 80 KB | No | Yes |
| Fonts | 60 KB | No | Yes |
| Total re-downloaded | 150 KB | 690 KB |
With one release number applied to every URL, the visitor fetches 30 + 400 + 120 + 80 + 60 = 690 KB. With per-file hashes it is 30 + 120 = 150 KB, which is 540 KB less, or 78%. For 10,000 returning visitors per release that is 540 KB × 10,000 = 5.4 GB (counting 1 GB as 1,000,000 KB). At 20 releases a month, the difference reaches 108 GB, assuming the same visitors return after each release.
Hashing only pays off if unchanged files keep the same name. Bundles that mix library code with your own code get a new hash on every edit, so put stable third-party code in its own bundle.
Why do visitors still see old files?
When a release is out and someone still sees the old version, one of these is usually true.
| Symptom | Likely cause | What to check or change |
|---|---|---|
| Old page, old assets | The HTML itself has a long lifetime, at the browser or the CDN | Use no-cache for HTML; purge the CDN copy once |
| New HTML, old file content | The file name did not change and the old copy is still fresh | Put a hash in the name; a long lifetime on a fixed name cannot be recalled |
?v= changed, CDN serves the old file | The cache key ignores the query string | Change the CDN setting or move the version into the name |
| Some visitors only | The file has no Cache-Control, so browsers guessed a lifetime | Send an explicit header |
| Works in a private window only | A service worker is answering from its own cache | Version the worker's cache; a new worker waits until old tabs close |
| Error on navigation in an old tab | The running app asks for a chunk that the deployment deleted | Keep previous builds for a while, or catch the error and reload |
| Broken only during a rollout | New HTML reaches a server that does not have the new file yet | Upload assets before switching the HTML |
The deleted-chunk case is easy to miss in testing, because it only affects people who opened the site before the release. Vite's documentation describes exactly this and emits a vite:preloadError event that an app can handle, for example by refreshing the page.
The service worker case follows from its lifecycle. According to web.dev, an updated worker installs next to the old one and waits until the old one controls no pages, so a visitor who keeps a tab open can stay on the old version after you have shipped.
How to find out which cache is serving the old file
- Read the HTML the visitor gets.
curl -sI https://example.com/shows itscache-controlandage. Then view the source and note the asset names it references. - Request the asset directly.
curl -sI https://example.com/assets/app.3f9a1c.jsshows the headers and, on most CDNs, a cache status header. - Compare with the origin. If you can reach the origin directly, the difference between the two answers tells you whether the CDN holds the old copy.
- Open the browser's Network panel. A response from memory or disk cache means the browser made no request at all. A response served by a service worker is labeled as such.
- Test with the cache disabled, then enabled. If the problem appears only with the cache on, it is a caching rule and not a faulty build.
Cache busting vs purging vs revalidation
| Cache busting | CDN purge | Revalidation | |
|---|---|---|---|
| What happens | The file gets a new URL | Copies are removed from the CDN | The cache asks whether its copy is still current |
| Reaches browser caches | Yes, through the new reference | No | Only when the browser decides to ask |
| Cost | A build step | An operation per release, possible origin spike | One request per check, often answered with 304 |
| Best for | Scripts, styles, fonts, versioned images | HTML and files whose URL must stay fixed | HTML and API responses |
Purging cannot fix a year-long lifetime already sitting in a visitor's browser. The reverse also holds: busting does nothing for a URL you cannot change, such as the home page. Most sites need all three, each for its own kind of file. A purge also empties the edge, so the cache hit rate drops until it refills; CDN cache explains how to read that.
Common cache busting mistakes
- Long lifetime first, hashing later. Fix the file names before you raise
max-age. - Random query strings on every request. It looks like a fix for staleness and quietly turns caching off.
- Deleting old builds on deploy. Visitors with an open tab or a cached page still ask for them.
- Hashing the HTML URL. People and search engines need stable page addresses; version the assets instead.
Cache busting releases in TapCub
Suppose you switch from one release number to per-file hashes. TapCub does not set your headers, rename files or purge a CDN; it measures what happens in visitors' browsers.
- Mark the release. In Configuration › Annotations, add an entry of type Release so the date appears on the trend charts.
- Watch for errors from old tabs. With
data-errors="true"in the snippet, Monitoring › Errors groups JavaScript errors and unhandled promise rejections, with the pages and sessions involved. A failed dynamic import that nothing catches shows up as a rejection. A missing file requested by a plain script tag is easier to find as a404in server logs. - Compare load times. In Monitoring › Performance, set the range to two weeks before and then two weeks after, and read P75 largest contentful paint and the loading breakdown. The page has no previous-period comparison, so note the first set of values.
- Check the slowest pages. If a page stays slow, confirm that its assets carry hashed names and a long lifetime.
Sources
- IETF, RFC 9111: HTTP Caching, section 2, June 2022: cache keys and storage.
- IETF, RFC 8246: HTTP Immutable Responses, September 2017.
- web.dev, Prevent unnecessary network requests with the HTTP Cache, and The service worker lifecycle. Checked 2026-12-03.
- Vite documentation, Building for production: load error handling. Checked 2026-12-03.
- Cloudflare, Caching levels. Checked 2026-12-03.
Was this explanation clear?
We use your answers to fix and expand this page.
Couldn’t send. Please try again in a minute.
Thanks for the feedback. We’ll use it to improve this page.You’ve already sent feedback on this page. Thanks.

Customer Experience Consultant
Writes about live chat, visitor conversations, and self-service, sharing practical ways to make customer communication clearer and more effective.