部署后的浏览器缓存

时间:2013-10-31 08:50:50

标签: apache .htaccess browser-cache

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

# 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设置为部署到服务器,我的问题是部署后会发生什么?浏览器是否会再次缓存文件,因为它们更改了服务器上的路径,或者用户必须等待时间到期? 感谢...

1 个答案:

答案 0 :(得分: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,那么浏览器将再次点击服务器并获取新的副本。