Since CDNs are based on quite complicated technologies, it may be hard to set up. Errors may appear after changing of settings to impart new features, or if a new content delivery strategy is being implemented. This article explains possible mistakes and troubleshooting measures.
- Wrong origin server URL where CDN servers pull static assets from is one of the main reasons of 404 errors. It means that files located on your domain cannot be found. As a rule, this mistake is caused by an extra subfolder in the original URL. How did it appear? URL might has been transformed by CMS platforms, adding its subfolders. The most optimal solution of this problem is to try using domain only in CDN settings, without subfolders. If that doesn't help, try to create the subfolder manually.
- Since each CDN server utilizes the origin domain to fetch the re quested file from the IP address to which the origin URL is bound, wrong origin IP resolution may be the reason for 404 and 502 errors. So if you move your website to another host, update all the information. Thus, CDN will be able to fetch files from the right location. Before activating origin IP resolution function, make sure that your files are available on the IP address saved on your control panel. IP address is specified in hosting panel, and may be written in the activation e-mail sent to you by the provider.
- Domain name misconfiguration. You can hide a CDN domain by your own subdomain with the help of CNAME. But when changing it for this or that reason (to introduce a generated name or parallelize downloads across hostnames), many people make mistakes. To avoid 404 errors, mind that the domain record must be CNAME type and link to your zone’s CDN domain. A newly-created record will be implemented within 48 hours.
- Wrong HTTP Referrer. Hot linking protection allows you creating a white list of domains that will access to your files. When considering whom to add to this list, think about safety aspects: bandwidth leeching and unauthorized sharing prevention. Allow access to CDND server content only for some certain sites, restricting it for the others. And don’t forget to enlist your own site, too. Otherwise, it won’t access the CDN and error 403 will appear.
Conclusion: when using CDN, always check information relevance, because it affects the whole work of your domain and users’ experience.