问题
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?)
回答1:
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>
来源:https://stackoverflow.com/questions/14690113/how-to-force-browsers-reload-static-assets-after-code-deployment