Cache busting is a technique that forces clients to download a new version of a file by giving that version a different URL. Because caches key on the URL, a new name counts as a new resource.
Why it matters
The best caching strategy for static assets is a very long lifetime, such as one year. The drawback is that you cannot recall a copy already stored in thousands of browsers. Cache busting resolves this: the HTML, which is revalidated often, points to a new asset URL after each deploy, while unchanged files keep their cached URL.
Example
<!-- query string (weaker) -->
<script src="/app.js?v=42"></script>
<!-- content hash in filename (preferred) -->
<script src="/app.3f9a1c7e.js"></script>
Bundlers such as webpack, Vite and esbuild generate hashed filenames automatically. The server then sends:
Cache-Control: public, max-age=31536000, immutable
Common mistakes
- Relying on query strings; some CDNs and proxies ignore them in the cache key.
- Using a manual version number and forgetting to bump it.
- Caching the HTML page for a long time, which then keeps pointing to old asset names.
- Deleting old hashed files immediately, which breaks users still holding the old HTML.
Related
Get notified when this term updates
Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.
यह पेज सामान्य जानकारी है, जिसे हमारी संपादकीय टीम ने लिखा है और दस्तावेज़ीकरण बदलने पर अपडेट किया जाता है। सर्वर और प्रदाता अलग-अलग होते हैं, इसलिए बदलाव पहले सुरक्षित तरीके से जाँचें। देखें: संपादकीय नीति और अस्वीकरण.