how to force browsers reload static assets after code deployment?

孤人 提交于 2019-12-08 03:16:51

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!