WebPagetest Forums

Full Version: negative scoring for wrong cache headers
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Ive come across a site whose doing this in .htaccess

<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|mp3|mp4)$">
Header set Cache-Control "public"
Header set Expires "Thu, 15 Nov 2010 20:00:00 GMT"
Header unset Last-Modified
#2 hours
<FilesMatch "\.(html|htm|xml|txt|xsl)$">
Header set Cache-Control "max-age=7200, must-revalidate"
<FilesMatch "\.(js|css)$">
SetOutputFilter DEFLATE
Header set Expires "Thu, 15 Nov 2010 20:00:00 GMT"

Why would anyone do that is beyond me. but... webpagetest.org gives this site an A in caching... In the same time the repeat view does a if-modified-since request for this.

Would have been easier to spot this mixup if WPT gave negative scoring for such things... small cache durations already result in a warning... negative duration should be an err

Thanks. The code right now favors a cache-control header and if one is present it will calculate a duration based on the time set. For expires headers it just checks for the presence and doesn't actually check the date (been a TODO for a while). If it's not too hard to parse the dates in c++ I'll see if I can get it added quickly, otherwise I'll make sure it's correct as we move individual rules to use Page Speed's logic.
Reference URL's