WebPagetest Forums

Full Version: Keep failing cache test
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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:
Code:
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>
     <FilesMatch  \.(gif|jpg|jpeg|png|swf)$ >
        ExpiresDefault a3019200
          Header append Cache-Control  public
     </FilesMatch>
     <FilesMatch  \.(xml|txt|html|js|css)$ >
          Header append Cache-Control  proxy-revalidate
     </FilesMatch>
     <FilesMatch  \.(php|cgi|pl|htm)$ >
          ExpiresActive Off
          Header set Cache-Control= no-cache
          Header set Pragma  no-cache
     </FilesMatch>
</IfModule>
</IfModule>
Do you have a test we can look at?
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
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.
Thanks I took these lines:
Code:
<FilesMatch  \.(xml|txt|html|js|css)$ >
<FilesMatch  \.(xml|txt|html)$ >
          Header append Cache-Control  proxy-revalidate
     </FilesMatch>
and changed the first one to:
Code:
<FilesMatch  \.(xml|txt|html)$ >

and that did the trick!
Reference URL's