我正在尝试调试我的.htaccess
文件,其中包含:
<FilesMatch "\.(html|swf)$">
<IfModule mod_headers.c>
Header set Cache-Control "no-cache, public"
</IfModule>
</FilesMatch>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 month"
ExpiresByType text/html "access plus 0 seconds"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
</IfModule>
重复访问我在Safari中看到的同一网页:
Name = Wrapper.html,Method = GET,Status = 200(OK),Type = text / html
Name = App.html,Method = GET,Status = 200(OK),Type = application / x-shockwave-flash
和Chrome:
Name = Wrapper.html,Method = GET,Status = 304(未修改),Type = text / html
Name = App.html,Method = GET,Status = 304(未修改),Type = application / x-shockwave-flash
问题是Safari应从服务器下载时应从缓存中检索,而Chrome正确地从缓存中检索。
那么,如何从服务器获取Status=304
到Safari(如Chrome所示)? (我猜这是根本原因,如果没有,请告诉我)
更新
我刚检查了缓存文件,似乎Safari并没有将下载的文件放在缓存中,因为它可以在以后的访问中进行绘制。不知道为什么。
答案 0 :(得分:1)
这与服务器和htaccess文件无关。 Safari发送的请求需要If-Modified-Since
标头,否则如果Last-Modified
时间早于请求中的那个时间,则apache将不会响应304。
我不知道为什么Safari不发送标题,或者它是在某些时候发生的,还是与某些浏览器设置有关。但是you're not the only one that this is happening to。