Using the Strangecode CDN

CDN what?

A Content Delivery Network (CDN) is a system of geographically dispersed web servers delivering cached copies of content transparently to clients. When a website is configured to use a CDN its content is loaded from edge servers located nearest the client rather than the site’s primary web server, reducing delivery costs and load on the central network and server. In short, CDN-enabled websites are faster, cheaper, and more reliable.

Strangecode’s CDN

We’re reselling the service of a major network provider, integrated into our hosting infrastructure in a way that makes it easy for our hosting customers to use. We’ve been running it on our own sites since the beginning of 2010 and it has flawlessly improved page load times and site reliability. We can fully customize your CDN account for special needs. Good stuff.

All our hosting accounts include CDN access out-of-the-box. If you have an older site which hasn’t been granted CDN access yet just ask us.

CDN bandwidth costs $0.20 per GB, and will appear on your regular Strangecode hosting invoice.

How to

To load files through the CDN you simply need to change the URLs which link to those files to use your custom CDN hostname. The first time the new URL is accessed, the file will be copied from your origin server onto the CDN and cached; subsequent requests for the file will be delivered entirely from the CDN’s edge servers.

Your custom CDN hostname is just your normal website domain name prepended with cdn. If you normally access static files at, the cached CDN version of the file would be accessible at If you use a subdomain like your CDN hostname would be

Example 1

Here’s how to load some javascript and css files through the CDN. A snippet from a page’s header:

<link rel="stylesheet" type="text/css" href="/css/screen.css" media="screen" />
<script src="/js/jquery.js" type="text/javascript"></script>
modified to load files through the CDN:
<link rel="stylesheet" type="text/css" href="" media="screen" />
<script src="" type="text/javascript"></script>

Example 2

If you’re loading images, you’ll turn something like this:

<img src="" />

into this:

<img src="" />

Example 3

If you use relative URLs in your CSS they’ll work so long as the file including them has been loaded through the CDN. If your CSS contains:

#logo { background: url(logo.png) no-repeat; }

it will work if the CSS files was included like this:

<link rel="stylesheet" type="text/css" href="" media="screen" />

What kind of content can be served by the CDN?

All types of static files: images, javascript, css, flash files, movies, audio, and binary file downloads (zip, dmg). Ask us if you have a need for high-volume downloads, media streaming, or file types not listed here.


Still need help? Send us a message.