Reputation: 4246
I'm trying to debug my .htaccess
file, which contains:
<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>
On repeated visits to the same webpage I see in 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
and for Chrome:
Name=Wrapper.html, Method=GET, Status=304 (not modified), Type=text/html
Name=App.html, Method=GET, Status=304 (not modified), Type=application/x-shockwave-flash
The problem is Safari downloads from server when it should retrieve from cache, whereas Chrome correctly retrieves from cache.
So, how do I get Status=304
from the server to Safari (as seen for Chrome)? (I'm guessing this is the root cause, let me know if not)
UPDATE
I just checked the cache file, and it seems Safari is not placing the downloaded files into the cache in the first place, for it to draw from upon future visits. Not sure why.
Upvotes: 1
Views: 468
Reputation: 143906
This doesn't have anything to do with the server nor the htaccess file. The request that Safari sends needs an If-Modified-Since
header or else apache won't respond with a 304 if the Last-Modified
time is before the one that was in the request.
I don't know why Safari doesn't send the header, or whether it's just happening some of the time or has to do with some browser setting somewhere. But you're not the only one that this is happening to.
Upvotes: 1