Gal Ben-Haim
Gal Ben-Haim

Reputation: 17803

how to force browsers reload static assets after code deployment?

I'm running the following setup: haproxy -> web traffic -> varnish -> nginx (serve static assets) -> node.js (dynamic content) and haproxy -> websockets -> node.js

How can I force browsers to refresh static assets (JavaScript, CSS, ..) after code deployment? (expire/purge the cache?)

Upvotes: 2

Views: 3150

Answers (1)

Chris Kooken
Chris Kooken

Reputation: 33930

You can add a querystring to the file with a revision number. Increasing the revision number will force all the assets to come back down to the browser.

<script type="text/javascript" src="jquery.min.js?r=223"></script>

Upvotes: 8

Related Questions