[Answered ]-Update javascripts that are cached in the Chrome browser

2đź‘Ť

If we are talking about JS, the issue is that you are not bundling your assets correctly to support what is often termed “cache-busting.” Frameworks such as gulp, webpack and django_assets all have cache busting ready for you so that when you are ready to deploy, your users do not have to drop cache. For example, in django_assets/webassets the URL to your bundled JS file will be suffixed with a hash parameter so that when the contents of the JS file change, the URL will also change.

For the same reason, you have configured your web server to send out your media files with a so called far future expires header: Your web server sets the Expires header to some date many years in the future. Your user’s browser will never spend any time trying to retrieve an updated version.

What if you actually deploy an update to your site? Now you need to convince the browser to download new versions of your assets after all, but you have just told it not to bother to check for new versions. You work around this by modifying the URL with which the asset is included.

👤2ps

Leave a comment