Create a Zone Alias
The Zone Alias configuration always requires to configure the alias in the KeyCDN dashboard and to add the according CNAME in your DNS records. The Zone Alias grants access to your Zone by activating the specified domain on the KeyCDN edge servers.
The CNAME enables the domain name resolution to your Zone and is responsible for pointing your Zone Alias to the kxcdn.com Zone URL. Commonly used Zone Aliases are
Add first the CNAME record in your DNS or you cannot add the Zone Alias. E.g. cdn.yourwebsite.com CNAME lorem-1.kxcdn.com
- Add the CNAME record in your DNS (Zone Alias -> Zone URL). Check that your new DNS record is active with the DNS Check Tool. DNS changes could take some time depending on the TTL.
- Sign in to the KeyCDN dashboard
- Click on Zone Aliases in the left navigation bar. Click on New Zone Alias (blue button)
- Define a Zone Alias Name of your choice (e.g cdn.yourwebsite.com)
- Choose the Zone you want to map the Zone Alias to and click on “Add”
Here is an example how it might look like for static resource on your website (e.g. Zone Alias:
cdn.yourwebsite.com, Zone URL:
without CDN: <img src="http://www.yourwebsite.com/folderxyz/img.jpg" alt="just an example"> with CDN <img src="http://lorem-1.kxcdn.com/folderxyz/img.jpg" alt="just an example"> with CDN and Zone Alias <img src="http://cdn.yourwebsite.com/folderxyz/img.jpg" alt="just an example">
Commonly, a 403 Forbidden error will be shown if a CNAME record has been added however the corresponding Zone Alias is missing.
Wildcard Zone Alias
If you are delivering assets from multiple subdomains on your website, for example:
- Images from img.example.com,
- CSS from css.example.com,
- JS from js.example.com
you can use a wildcard Zone Alias. Defining a wildcard Zone Alias such as
*.example.com will allow you to easily point each subdomain towards your KeyCDN Zone URL.
Remember to add a CNAME record to your DNS settings to point the wildcard Zone Alias to the Zone URL.
Pointing root domains to your Zone URL
CNAME records are not supported on root domains (e.g. example.com) as they would conflict with the SOA- and NS-records (RFC1912 section 2.4: “A CNAME record is not allowed to coexist with any other data.”), an alternative is to redirect your root domain to a subdomain (e.g. www). Do the following in your DNS settings:
- Redirect your root domain to its www version with an URL or Forward record (e.g. www.example.com)
- Create a CNAME record for www and point it to your Zone URL
Some DNS providers do not support redirects (known as URL or Forward records), instead use the free service wwwizer: http://wwwizer.com/naked-domain-redirect
We recommend to avoid this approach as it negatively impacts performance and generates additional RTTs. Use subdomains instead.
There are DNS providers offering better solutions to this problem such as nsone. They call it ALIAS records (nsone) or CNAME Flattening (Cloudflare), which allows to point a root domain (“naked” domain) to a Zone Alias. It is important to note that the CNAME record will be masqueraded as an A record.
Advantages of Using a Zone Alias
There are a few advantages to setting up a Zone Alias as opposed to using the KeyCDN Zone URL provided in the dashboard.
- Using a Zone Alias allows you to setup a generic subdomain such as
cdn.yourdomain.com, allowing you to keep the same URLs even if you point your CNAME record to a different URL in the future (e.g. if you want to change CDN providers)
- The domain will contain keywords relevant to your site, therefore your assets are closer bound to your domain which is better in terms of CDN SEO.
- Using a Zone Alias allows you to take advantage of Let’s Encrypt SSL which provides you with a custom SSL certificate for free.
- Zone Aliases allow you to view indexed images data using the sitemap view in Google Search Console.
Disadvantages of Using a Zone Alias
- Since Zone Aliases are created using a CNAME, this produces an additional DNS lookup. However, if you set your DNS TTLs high enough (e.g. greater than 3600s) there should be little to no affect on speed.