Archive

Posts Tagged ‘WWW’

Browser caching with SSL

March 18th, 2009 No comments

I’m using several SSL-enabled sites daily, and since browsers traditionally refuse to cache anything negotiated through an SSL connection on disk, performance has a tendency to suffer. I notice this every time I visit Fogbugz, and I have to wait for my browser to load all the neat little icons they use. Fortunately, according to James Henstridge, it’s possible to make Firefox 3+ cache these files now.

Basically he suggests to go to about:config and change the setting browser.cache.disk_cache_ssl to true. There have been issues prior to Firefox 2, but these should be fixed in Firefox 3.

If you’re running a webserver, adding the header value Cache-Control: Public will allow most browsers to automatically cache server files. If you’re paranoid, you should only add this header to scripts, images and stylesheets. Here is an example for Apache that allows browsers to cache a selected fileset for up to one week:

# Cache-control: Public activated disk-caching for HTTPS
<FilesMatch “\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$”>
Header set Cache-Control “max-age=604800, public”
</FilesMatch>
Categories: Uncategorized Tags: , , , ,