Support

Find answers, guides, and tutorials to supercharge your content delivery.

Complete CDN Migration Guide

Updated on October 4, 2018

This guide describes the step by step process of how to setup a CDN to migrate the delivery your website's static assets to KeyCDN's server locations. Once the below steps are complete, you will have successfully created a KeyCDN Zone, integrated it with your website, and will be delivering assets from KeyCDN's edge servers.

1. Creating a Zone

The first step in how to setup a CDN is creating a Zone within KeyCDN. A Pull Zone automatically pulls all of your origin server's static content and caches at a particular edge server location upon client request. Once the content is cached, subsequent client requests will be routed to the nearest edge server location.

To setup a KeyCDN Pull Zone complete the following steps.

  1. Log in to the KeyCDN dashboard.
  2. In the left navigation sidebar click Zones.
  3. Click Add Zone.
  4. Set the Zone Type as pull.
  5. Define the Origin URL (e.g. https://www.yourwebsite.com).
  6. Click Save.

The status of the new Zone will now be set to deploying. This remains for about 5 minutes before the status changes to active and the Zone is ready for use.

Alternatively, using a Push Zone is recommended for uploading files greater than 10 MB in size and is required for files larger than 100 MB (because Pull Zones don't cache anything over 100 MB).

2. CDN DNS changes (CNAME)

Once your Zone is created, you have the option to use the Zone URL (e.g. example-1a2b.kxcdn.com) which is provided on the KeyCDN Zones page for integration purposes.

Alternatively, a Zone Alias can be created which will provide you with a custom CDN URL (e.g. cdn.yourwebsite.com). Creating and implementing a Zone Alias involves adding a record in your DNS settings which is outlined in the steps below.

  1. Add a CNAME record in your DNS. This will be your desired Zone Alias that points to your Zone URL. For example, create cdn.yourwebsite.com as a CNAME record that points to example-1a2b.kxcdn.com. Check that your new DNS record is active with our DNS Checker tool. Please keep in mind DNS changes can take some time depending on the TTL.
  2. Log in to the KeyCDN dashboard.
  3. In the left navigation sidebar click Zone Aliases.
  4. Click Add Zone Alias.
  5. Define the Zone Alias that matches the CNAME record created in step 1 (e.g cdn.yourwebsite.com).
  6. Choose the Zone that you want to map the Zone Alias to.
  7. Click Save.

A Zone Alias also takes approximately 5 minutes before it is fully deployed and ready for use.

3. Verifying your assets are accessible via the CDN

Now that you have a Zone created and a Zone Alias defined, test an asset path using the CDN URL to verify your assets are being properly delivered via the CDN.

  1. Choose one of your website's static asset URLs (e.g. https://www.yourwebsite.com/path/to/example.css).

  2. Replace the origin URL with your new KeyCDN Zone URL.

  3. Access your new Zone URL in a browser, use our Performance Tool, or use a curl command to verify the asset returns a 200 status (e.g. **https://yourzone-1a2b.kxcdn.com**/path/to/example.css)

    curl -I https://yourzone-1a2b.kxcdn.com/path/to/example.css
    **HTTP/2 200**
    server: keycdn-engine
    date: Wed, 12 Feb 2020 02:57:19 GMT
    content-type: text/css
    vary: Accept-Encoding
    last-modified: Tue, 11 Feb 2020 12:50:34 GMT
    etag: W/"5e42a31a-28663"
    expires: Wed, 19 Feb 2020 02:57:19 GMT
    cache-control: max-age=604800
    strict-transport-security: max-age=31536000; includeSubdomains; preload
    content-security-policy: default-src 'self' 'unsafe-inline' 'unsafe-eval' https: data:
    x-frame-options: SAMEORIGIN
    x-xss-protection: 1; mode=block
    x-content-type-options: nosniff
    referrer-policy: no-referrer-when-downgrade
    x-cache: HIT
    x-edge-location: usse
    access-control-allow-origin: *
    

If by accessing an asset via the CDN URL is successful, then your Zone is fully propagated and you can now move on to the integration phase.

4. Integrate KeyCDN into your website

Once this step is complete, your website will be fully integrated to use KeyCDN to deliver your static assets. We have many CMS integration and framework integration guides available, however this article will specifically focus on a WordPress KeyCDN integration.

  1. The first step is to download a plugin such as the WordPress CDN Enabler plugin to integrate your CDN URL with your website.
  2. Once the plugin is installed and activated, navigate to the settings page of CDN Enabler and enter your Zone URL or Zone Alias (if you created one).
  3. Save your settings and double check your site's page source to ensure that your static file URLs have been rewritten.

4. Checking logs and statistics

Now that your site is fully integrated with KeyCDN, your static assets will be delivered via our content delivery network across the globe to supercharge your content. As content is delivered via the CDN, logs and statistics are tracked and accessible via the KeyCDN dashboard. These can be accessed via the Reporting option on the left-hand sidebar. Detailed charts display various information pertaining to your Zones such as usage or analytics.

For a more granular view of your logs, KeyCDN also allows you to perform log forwarding and have your logs received by syslog.

Other considerations

Supercharge your content delivery 🚀

Try KeyCDN with a free 14 day trial, no credit card required.

Get started
KeyCDN uses cookies to make its website easier to use. Learn more about cookies.