Website needs force refresh after deploy

前端 未结 3 1270
孤城傲影
孤城傲影 2021-02-05 02:13

After deploying a new version of a website the browser loads everything from its cache from the old webpage until a force refresh is done. Images are old, cookies are old, and s

相关标签:
3条回答
  • 2021-02-05 02:40

    You could use http headers to control the cache of your clients.

    I'll just leave this here for you. http://support.microsoft.com/kb/234067

    0 讨论(0)
  • 2021-02-05 02:48

    You can append a variable to the end of each of your resources that changes with each deploy. For example you can name your stylesheets:

    styles.css?id=1
    

    with the id changing each time.

    This will force the browser to download the new version as it cannot find it in its cache.

    0 讨论(0)
  • 2021-02-05 02:54

    For ASP.NET you can use the cache control and expires headers. You can also set up similar headers in IIS 7 for your images. If you have any other cookies you can expire them manually.

    I have not tried it, but it looks like you can do an ever better job of bulk setting cache control in IIS 7. See this thread and this link. At that point you are only left with unsetting any custom cookies you have (which you won't be able to control with HTTP cache control settings).

    I don't know of any method to "unset everything all at once" easily.

    0 讨论(0)
提交回复
热议问题