In order to set up a basic CDN configuration, you need to configure the CDN to;
- Fetch content from an “Origin” hostname
- Set the hostname that will be used to deliver content via CDN “Host”
- Define caching policy
Typical CDN configuration example
- origin-static.mywebsite.com Origin Pull (Customer Server)
- origin.something.cdnprovider.net Origin Push (CDN Storage)
- Honour Caching Headers set max-edge
- Override Caching Headers to a specific max-edge
You can set the CDN to either fetch content from your origin server or purchase CDN storage from the selected CDN provider where you will be physically locating static content to be accelerated via CDN (Not all CDN provider offer CDN storage).
Origin Push (CDN Storage)
Origin push is very much like having a secondary server partition on the CDN network. The user uploads content directly to the assigned CDN storage folder (automatically via API or manually). Once CDN storage is configured, the user receives an Origin and Ingest Host as well as Username and Password.
Typical CDN Storage Setup example
Origin Host: origin.something.cdnprovider.net
Ingest Host: ingest.something.cdnprovider.net
You will be using the Origin Host to set up the CDN to fetch content from the allocated CDN storage and the Ingest Host, Username and Password to login to your CDN storage to physically locate static content to be delivered via CDN
Origin Pull (Customer Server)
When you set the CDN to Origin pull, you instruct the CDN to fetch content from your origin server by assigning a hostname that points directly to your origin server where your online content is located.
The “Host” in CDN dictionary is a hostname that you will be using to deliver content via CDN. Once your CDN account is ready, you will be given a CDN URL CNAME (e.g. yourwebsite.something.cdnprovider.net) that you will then use to CNAME via DNS to your chosen Host.
Typical Host CNAME DNS setup
static.mywebsite.com CNAME yourwebsite.something.cdnprovider.net
You have two choices, you can instruct the CDN to either honour your set host cache header max-edge or override. If you decide to override your content cache headers you will need to provide the CDN with instruction on how. Usually caching roles are applied either by folders by defining paths and related caching roles or by type of content and related caching roles. You need to instruct the CDN how long to cache content on CDN POPs and how long to check on users browsers. We highly recommend keeping user browser caching very low (30 minutes) as once content is cached on the browser cannot be cleared unless user itself clear cache. Cached content on the CDN network can be cleared from cache via CDN API or CDN online administrative interface.
Typical Override Caching Policy setup
/images/* 7 Days CDN – 30 Minutes Browser
/video/* 30 Days CDN – 30 Minutes Browser
/media/pdf/* 30 Days CDN – 30 Minutes Browser
/static/html 1 Days CDN – 30 Minutes Browser
/static/css 1 Days CDN – 30 Minutes Browser
By type of content
jpg | jpeg | png | gif | 7 Days CDN – 30 Minutes Browser
css | js 1 Days CDN – 30 Minutes Browser
htm 1 Days CDN – 30 Minutes Browser