Friday, April 09, 2010
Cache flow problems, II
Google just announced that website speed is part of their ranking criteria (link via Hacker News), and seeing how Dad is still reporting issues with viewing this blog, I figured I might as well play around with Page Speed (which requires Firebug, an incredible website debugging tool that runs in Firefox) and see if I can't fix the issue (and maybe speed up the site).
Now, I realize there isn't any real need to speed up my site, but the suggestions by Page Speed weren't horrible, and actually, not terribly hard to implement (seeing how the main website here consists of nothing but static pages, with the only dynamic content here on the blog) and mainly consisted of tuning various caching options on the pages, and some minor CSS tweaks to keep Page Speed happy.
The caching tweaks for the main site I made were:
FileETag MTime Size AddType "image/x-icon" .ico ExpiresActive On ExpiresDefault "access plus 1 year" ExpiresByType text/html "access plus 1 week" ExpiresByType image/x-icon "access plus 1 month" <LocationMatch "\.(ico|gif|png|jpg|jpeg)$"> Header append Cache-Control "public" </LocationMatch>
HTML pages can be
cached for a week,
favicon.ico can be
cached for a month, and everything else for a year. Yes, I could have made
favicon.ico cache for a year, but Page Speed suggested at least
a month, so I went with that. I can always change that later. I may
revisit the caching for HTML pages later; make non-index pages cachable for a
year, and index pages a week, but for now, this is fine.
And it does make the pages load up faster, at least for subsequent visits. Also, Page Speed and YSlow both give me high marks (YSlow dings me for not using a CDN, but my site isn't big enough to require a CDN, but that's the only thing YSlow doesn't like about my site).
And as an attempt to fix Dad's issue, I added the following to the configuration for The Boston Diaries:
<Files index.html> Header set Cache-Control "no-cache" </Files>
Basically, no one is allowed to cache the main page for this blog. I'll see how well that works, although it may take a day or two.