WebPagetest Forums
Keep failing cache test - Printable Version

+- WebPagetest Forums (https://www.webpagetest.org/forums)
+-- Forum: Web Performance (/forumdisplay.php?fid=3)
+--- Forum: Testing Tools/Services (/forumdisplay.php?fid=6)
+--- Thread: Keep failing cache test (/showthread.php?tid=13284)

Keep failing cache test - Andy5000 - 10-10-2014 12:39 AM

I keep failing the cache test here with every site I try (although some of them are scoring 100% on pingdom tools). Here is the htaccess code I'm currently using:
Header unset FileETag
FileETag none
<IfModule mod_expires.c>
<IfModule mod_headers.c>
     ExpiresActive On
     ExpiresDefault  "access plus 1 month"
     ExpiresByType image/x-icon  "access plus 1 year"
     ExpiresByType image/gif  "access plus 1 month"
     ExpiresByType image/png  "access plus 1 month"
     ExpiresByType image/jpg  "access plus 1 month"
     ExpiresByType image/jpeg  "access plus 1 month"
     ExpiresByType text/css  "access plus 4 hour"  
     ExpiresByType application/javascript "access plus 1 year"  
     <FilesMatch  \.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$ >
          ExpiresDefault "access plus 3 month"
          Header append Cache-Control  public
     <FilesMatch  \.(gif|jpg|jpeg|png|swf)$ >
        ExpiresDefault a3019200
          Header append Cache-Control  public
     <FilesMatch  \.(xml|txt|html|js|css)$ >
          Header append Cache-Control  proxy-revalidate
     <FilesMatch  \.(php|cgi|pl|htm)$ >
          ExpiresActive Off
          Header set Cache-Control= no-cache
          Header set Pragma  no-cache

RE: Keep failing cache test - andydavies - 10-10-2014 11:58 PM

Do you have a test we can look at?

RE: Keep failing cache test - Andy5000 - 10-11-2014 12:39 AM

OK here's the result from my test blog:

RE: Keep failing cache test - andydavies - 10-11-2014 04:30 AM

Looks like something is adding a max-age=0 which will force the browser to make a request for the resource

Cache-Control: max-age=0, proxy-revalidate

RE: Keep failing cache test - pmeenan - 10-11-2014 04:35 AM

It looks like your FilesMatch rules are kicking in. but the default Cache-Control header you are sending includes max-age = 0. At least for testing it might be worth setting an expires value in the match blocks for js/css and images.

RE: Keep failing cache test - Andy5000 - 10-11-2014 04:52 AM

Thanks I took these lines:
<FilesMatch  \.(xml|txt|html|js|css)$ >
<FilesMatch  \.(xml|txt|html)$ >
          Header append Cache-Control  proxy-revalidate
and changed the first one to:
<FilesMatch  \.(xml|txt|html)$ >

and that did the trick!