About content delivery networks (CDNs)

CDN

CDN stands for Content Delivery Network. Shopify provides all its customers with a world class CDN run by Fastly at no additional charge.

This means that your Shop will be fast around the globe, even in remote areas like New Zealand and South Africa despite the Shopify servers being in North America. Faster load times have shown over and over again to lead to more sales, so this is a big win for everyone.

You can read more about Fastly on the Fastly website.

Caveats

Because a CDN means that all images of a store are cached at thousands of "edge servers" around the world, Shopify has to indicate to the CDN that images have changed manually.

To do this, Shopify uses the asset_url filter which automatically appends "asset versions" to all urls generated. This is the ?v=1384022871 style appendages that you see all over Shopify.

If you link to images without using the asset_url filter and later upload a new version of the same image you may not see the updates reflected for a day or more.

CSS

CSS often exhibits the above issue. If you reference images directly from your CSS then these urls will be static and will not carry the asset version that Shopify updates automatically. To solve this you will have to rename your .css file to .css.liquid so that Shopify runs the css file through the liquid generator after saving.

Once done, edit your .css.liquid and change references such as:

background: url(bg.gif);

to this:


background: url({{'bg.gif' | asset_url}});

Want to discuss this page?

Visit the Shopify Community

Ready to start selling online with Shopify?

Try it free