Recently, I began serving my static files(images, css, javascript files) via Amazon’s Cloudfront and S3 services to reduce the bandwidth on my web host and also speed up the delivery of web pages to visitors. I wrote a tutorial on how to set this up using the plugin W3 Total Cache on my other blog.
One of the tools I’ve used to track and measure the performance of this blog is YSlow, which analyzes and grades web pages on a set of criteria including the number of HTTP requests, the location of your Javascript and CSS files, and whether you Gzip components.
One of the rules that I’ve often ignored is the use of a CDN. I always thought that CDN’s were solely for high traffic sites like reddit or Tumblr, but after encountering numerous small niche blogs that have their content distributed using a CDN, I relented. Combined with the ridiculously low cost, and the numerous tools available that make it easy to set up, it was a no-brainer to make use of a CDN on LonePlacebo.
After making the transition over to a CDN, I ran YSlow once again, and it still gave me an “F” for the use of a CDN. Digging further I found out why this was the case via the YSlow FAQ page.
The score for this rule is computed by checking the hostname of each component against the list of known CDNs. Unfortunately, the list of “known CDNs” are the ones used by Yahoo!. Most likely these are not relevant to your web site, except for potentially yui.yahooapis.com. If you want an accurate score for your web site, you can add your CDN hostnames to YSlow using Firefox’s preferences.
Here’s how to add a CDN hostname to YSlow:
- Go to about:config in Firefox.
- Right-click the window and select New > String to create a new string preference.
- Enter extensions.yslow.cdnHostnames for the preferences name
- Enter the hostname of your CDN for the string value. For example, mine is static.loneplacebo.com. If you want to enter multiple CDN’s, separate them using commas.
- Quit Firefox and relaunch it
If you did everything correctly, you should see your CDN’s hostname in the details for the CDN rule in YSlow.
YSlow is currently available as an extension for Firefox and Chrome.
How do I add my CDN hostname to YSlow for rule 2? [Yahoo Developer Network]





