Skip to content

Prevent CDN caching your updated JavaScript files

sketchboard.io
1 pointsaiki1 comment
On HN

Comments

TL;DR

extract some value from the file that changes with its content --like content's md5, or modified timestamp-- and append it to the file name

for example, let's say "index.js" and its md5 is "30c2234" (shortened for readability)

    <script src="file-30c2234.js">
later when you modify the file, the hash change, and clients start to request the new one.

this allows to set cache's evict time in doomsday

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.