1

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.

Community
  • 1
  • 1
ggkmath
  • 4,188
  • 23
  • 72
  • 129

1 Answers1

1

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.

Community
  • 1
  • 1
Jon Lin
  • 142,182
  • 29
  • 220
  • 220
  • http://writing.amanjeev.com/2011/02/safari-4x-and-its-caching-woes.html `Safari 4 precisely is being a snob. It does not send that header at all. All it sends is Pragma: no-cache. That is not very helpful.` Adding but sure how related this is. – ggkmath Oct 31 '13 at 21:48
  • @ggkmath Is the first article related to Apache? I'm almost 100% sure apache returns all dates in standard form. – Jon Lin Oct 31 '13 at 21:58
  • Yes, my posting uses Apache. I'm grasping here, it may be completely unrelated. – ggkmath Oct 31 '13 at 21:59
  • It appears issuing cache manifest does result in Safari caching app, but I really can't impose users to store what should be in the normal cache, onto their private disk space. So, it's not a solution for me. Wonder if anyone else has any ideas how to resolve? – ggkmath Nov 01 '13 at 21:47