Topic: Browser caching not working
I recently watched Greg Pollack's podcast (http://content.newrelic.com/railslab/vi veness.mp4) on page responsiveness and quickly set about setting an expires header, to start with, for all my images.
My first attempt was to add the following to my .htaccess file:
ExpiresDefault "access plus 1 day"
I restarted my server and used YSlow to see if they had been cached, which they were not. Using FF, I took a look at my cached objects using 'about:cache?device=disk' and could not find any of my images. So I tried this:
ExpiresByType image/png "modification plus 1 day"
I then looked at YSlow, about:cache and event tried to look at a specific image using curl (notice using the rails time/versioning for that image made it unfindable, so I just queried the image):
younker % curl -- head http://localhost:3000/images/tour/intro_page.png?1262626631
zsh: no matches found: http://localhost:3000/images/tour/intro_page.png?1262626631
younker % curl --head http://localhost:3000/images/tour/intro_page.png
HTTP/1.1 200 OK
Date: Mon, 08 Feb 2010 18:34:33 GMT
Last-Modified: Mon, 04 Jan 2010 17:37:11 GMT
Again, nothing. So I tried both config entries above 1 at a time in my <root>/vendor/rails/railties/configs/apache.conf, restarting after each. Nothing. I also then changed the filesmatch regexp to the following just in case the rails versioning was throwing it off:
Again, it did not cache.
What am I doing wrong? Why are these images not caching? Am I missing some config option?