【问题标题】:Browser caching after deploy部署后浏览器缓存
【发布时间】:2013-10-31 08:50:49
【问题描述】:

我的服务器上有这个缓存命令:

# BEGIN Expire headers
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 2 days"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType text/css "access plus 7 days"
ExpiresByType text/javascript "access plus 7 days"
ExpiresByType application/javascript "access plus 7 days"
</IfModule>
# END Expire headers

我已经检查过了,缓存工作正常。我已经为部署到服务器设置了 Capistrano,我的问题是部署后会发生什么?浏览器是否会再次缓存文件,因为它们更改了服务器上的路径,或者用户将不得不等待时间到期? 谢谢...

【问题讨论】:

    标签: apache .htaccess browser-cache


    【解决方案1】:

    my question is what will happen after deploy? Will the browser cache the files again because they changed the path on the server or user will have to wait for time to expire?

    不幸的是,用户将不得不等待浏览器将缓存数据过期,因为浏览器无法知道这些文件是否已更改。但是,如果您可以更改这些文件的 src paths,那么浏览器将再次访问服务器并获取新副本。

    【讨论】:

    • 感谢您的回答。哪个更好用:eTag 或 LastModified 强制浏览器再次缓存?或者你提到的 - URL指纹?再次感谢...
    • Etag 被认为更强大,请查看此链接:stackoverflow.com/questions/824152/…
    猜你喜欢
    • 2018-04-18
    • 1970-01-01
    • 2012-07-15
    • 2020-08-31
    • 2021-05-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多