Setting up a CDN to work with your website is easy and can be done in just a few steps. The article “How Does a CDN Work” is a recommended read if you are not yet familiar with a Content Delivery Network.
Pull Zones are the most commonly used Zone Type and are the recommended method for most CDN users. With this method, the CDN automatically pulls static content from your origin server and caches it on the edge servers. Once the content is cached, visitor requests will be routed and delivered from the nearest possible edge server location.
To get started with your KeyCDN integration, complete the following 3 steps.
- Create Your Zone
Creating a KeyCDN zone is easy. Login to your KeyCDN Dashboard, navigate to Zones and select Add New Zone. Then, follow the steps below to create your first zone.
- Choose a Zone Name
- Select Zone Type “Pull”
- Define your origin URL and click Save
- Wait approximately 5 minutes for the zone to fully deploy
Alternatively, using a Push Zone is recommended for uploading files greater than 10MB in size and is required for files larger than 100MB (Pull Zones do not cache anything over 100MB).
- Check Your CDN Assets
Once your Zone is fully deployed, you’ll want to check an asset to see if it is properly accessible via the CDN.
- Choose one of your website’s static asset URLs
Example:http://yourwebsite.com/assets/css/style.css
- Replace the origin URL with your new KeyCDN Zone URL
- Access your new CDN URL in a browser or use a cURL command in your CLI to verify the asset returns a 200 status
Example:http://yourzone-1c6b.kxcdn.com/assets/css/style.css
curl -I http://yourzone-1c6b.kxcdn.com/assets/css/style.css HTTP/1.1 200 OK Server: keycdn-engine Date: Thu, 16 Jun 2016 17:47:52 GMT Content-Type: image/webp Content-Length: 6352 Connection: keep-alive Last-Modified: Thu, 31 Mar 2016 23:56:22 GMT ETag: "18d0-52f61026f0829" Expires: Thu, 23 Jun 2016 17:47:52 GMT Cache-Control: max-age=604800 Link: <http://yourwebsite.com/assets/css/style.css>; rel="canonical" X-Cache: HIT X-Edge-Location: usny Access-Control-Allow-Origin: * Accept-Ranges: bytes
Once you have verified that your assets are accessible via the CDN URL, you can move on to the next step of integrating KeyCDN with your website.
- Integrate the CDN with Your Website
The following integration guides will help you to quickly integrate KeyCDN into your web projects: