Current time: 10-22-2019, 12:54 AM Hello There, Guest! (LoginRegister)

Post Reply 
 
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
negative scoring for wrong cache headers
05-16-2011, 05:07 PM
Post: #1
negative scoring for wrong cache headers
Ive come across a site whose doing this in .htaccess

Code:
<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
</FilesMatch>
#2 hours
<FilesMatch "\.(html|htm|xml|txt|xsl)$">
Header set Cache-Control "max-age=7200, must-revalidate"
</FilesMatch>
<FilesMatch "\.(js|css)$">
SetOutputFilter DEFLATE
Header set Expires "Thu, 15 Nov 2010 20:00:00 GMT"
</FilesMatch>

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

-Sajal

cdnplanet.com: We help you select the right CDN
Visit this user's website Find all posts by this user
Quote this message in a reply
05-17-2011, 02:12 AM
Post: #2
RE: negative scoring for wrong cache headers
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.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)