CDN stands for content delivery network. This is a geographically distributed network of interconnected servers. The aim is to speed up the transfer of web content to the user, by giving access to the data relative to where the user lives. For example, if one user is accessing a web page from Spain, it makes more sense for the user to access this data from a server in Spain or a neighboring country.
With CDN technology, you can cache and save various site elements related to static (immutable) content, including images, audio, video, JS, and CSS files. A CDN stores copies of the static site content on its servers worldwide, and when a user opens a web resource, the content will be downloaded from the nearest network server.
Therefore, the traffic passes along the most optimal route. The load on the network is reduced, and the maximum connection speed is achieved. As a result, sites using CDNs load faster.
Some CDN providers are able to process static and dynamic data. Dynamic data refers to when the data is changeable and adapted to a specific user, which is generated on the server at the time of receiving the request. Speeding up of dynamic content delivery when using a CDN is achieved by choosing the optimal network route and improving bandwidth. Unlike having a separate server, the total bandwidth of the CDN is easily scalable and practically unlimited.
CDNs are also used to distribute streaming content (e.g. the streaming of audio and video). With streaming CDNs, the data stream is relayed to servers that are already part of the network, and then distributed to users. With the help of load balancers, requests are redirected to the least loaded servers at that time.
To use a CDN, you need to create a domain in the form of:
This is where the content will be distributed from and connected to a CDN provider. As a rule, clients are offered two options for the CDN URL:
The user types the address in the browser bar such as:
www.domain.com, (where the HTML page is located). At the same time, all static content, such as images or videos are loaded from the CDN (from the address
To connect a CDN to individual page elements (images, JS scripts, CSS styles, etc.), you need to register their addresses on the CDN server in the source code of your site, for example, as shown in the screenshot below:
GeoDNS and AnyCast technologies are used to determine the caching servers closest to the user.
Using GeoDNS, you can bind multiple IP addresses to the same domain. Depending on the geographical location specified by the IP address from which the request was sent, the user is redirected to the server closest to them.
With AnyCast technology, several geographically distributed servers are assigned the same IP address (IPv4 or IPv6), called an anycast address. The routing system selects the most suitable server.
Content delivery networks tend to be quite expensive, so the cost criteria plays an important role when choosing a supplier.
Pricing models can be different:
Monthly or annual subscription (for example, from Cloudflare provider):
Payment for the amount of content transmitted over the network (Amazon Cloudfront):
The more traffic to the servers, the less the cost of one GB.
The cost of using a CDN depends on the number of servers involved and their location, and options included in the package, etc.
In the low-cost CDN market, you can find tariffs from $0.01 for 1 GB of traffic, without having to buy any monthly subscription (BunnyCDN):
Some providers offer a free trial period, free tariffs for individuals, etc.
The speed of websites is increasingly essential to rank well in search engines. In 2021 Google made the time required to load the main content of a page, one of the ranking signals as part of the Core Web Vitals indicator.
If a site loads too slowly, this can lead to a loss of users. This also affects the behavioral factors that Google looks at (such as bounce-back rate) which can then lead to a demotion in the rankings.
Google's research clearly shows how content loading time affects a site's behavioral metrics. For example, as a page's loading time increases from 1 to 10 seconds, the probability of a mobile site visitor leaving increases by 123%.
The use of content delivery networks is one of the ways to solve this problem. Geographically distributed servers included in the CDN help to make the site's response time minimal for users.
The site's reliability also increases - thanks to the distribution of CDN servers, the content remains available even during peak loads. In case of accidents and failures, traffic is automatically routed to other network servers.
When the file is changed on the primary server, it will remain unchanged on the caching servers. However, modern CDNs provide the function of periodically clearing and updating the cache, deleting old content, and replacing it with new versions to solve this problem.
If for some reason, your "neighbors" on the CDN provider's IP are blocked, your site may be blocked along with them. In this case, you should send a request to the CDN provider to change the IP address.
Content from your site, such as images, may be loaded from the CDN server that cached your image, rather than the site itself. For a search engine, this means that the image is not actually on your site but another one. As a result, you may lose traffic to your images.
To avoid this, you can give search robots the version with the image stored on your server and not the version from the CDN. Or you need to upload images to a subdomain on your second-level domain, for example, on a CDN.domain.com, and save the names and hierarchy of files.
For example, if the path to the image before using CDN looked like this:
after it should look like this:
This will help the search engine link images to your site, and you will save traffic from image searches.
However, Google analyst John Muller stated that there is no SEO bonus for placing images on the same host/domain. There are some studies that indicate that when using CDN, even the presence of subdomains may not solve the problem. It, therefore, does not guarantee small websites will be able to improve their position in image search.
CDNs can cause problems with duplicate content if you misconfigure it. Duplicates occur when the search engine indexes copies of pages uploaded via CDN.
Case study: One company providing SEO services experienced this problem.
Google's index included full copies of pages that were stored on the company's CDN (the company cached not only media content, but also the web pages themselves). The search engine indexed the pages on the CDN domain (as well as their normal domain). As a result, about 13.5 thousand duplicate pages appeared.
To solve this problem, you need to configure the canonical header. This is an additional HTTP header that is added to your CDN and tells the Google scanner that the content in your CDN is only a copy.
You can also configure the rel=canonical attribute of the
<link> tag by specifying as canonical (preferred for indexing) The URL of the main domain. You can also prohibit the subdomain from being indexed.
However, users who visit the subdomain will not be taken into account, which could lead to a deterioration in the site's behavioral factors. To remedy this, you would need to move the CDN version to a separate subdomain (cdn.domain.com), register it in the Webmaster panel. You could then monitor the site's indexing and the appearance of errors that may occur when using CDNs.
Content changes during delivery (code minification, structural changes) can have risky outcomes. Even incorrectly reducing the source code by removing unnecessary spaces, unimportant elements, etc., can negatively affect the performance of a web resource. More significant changes (transferring the JS code to the end of the HTML page, merging files) can disrupt the site's functionality if there is any small error.
For this reason, it's best practice to delete unused or duplicate code manually, just in case an automated service creates any errors. Within a CDN these functions tend to be disabled by default in the settings, as they can create the most errors.
CDN servers themselves protect the source server from hacker attacks, but, on the other hand, their use creates more opportunities for hackers. Companies need to be careful, especially when transferring confidential data. Therefore, network security is also an important criterion when choosing a CDN provider.
Since the content is no longer only on your server but is also hosted on several CDN servers, this leads to a loss of control over the web resource's content.
One such example of this being when a company posted all their images on a CDN service to speed up their loading. A year later, this resource ceased to exist. The site that posted all their content there, lost all the images in their online store, blog, etc. As a result, their position plummeted in the SERPs, and it took a long time to find new images and restore the site's position.
CDNs can be very helpful to:
Large online stores and other types of sites focused on making their content more accessible in different regions or countries.
The Amazon online store, stores static content on CDN servers.
Services that distribute multimedia content and streaming.
For example, Kiswe is a company that provides live ticket streaming to fans around the world, including concerts, sporting events, and live television.
Resources that distribute game content and software.
For example, the Finnish media company Rovio Entertainment, which is behind the creation and distribution of the Angry Birds series of games, uses Amazon CloudFront, because this service helps reduce the latency of API calls and integration with AWS Shield. AWS WAF provides protection against DDoS attacks.
Since the cost of CDN services are relatively high and the use of this technology carries significant risks, it makes sense to use it for large international companies that transmit a large amount of media content. Or where their servers cannot cope with the demand.
The prerequisites for the effective use of a content delivery network are:
You also need to check the download speed and other indicators of your site's quality before and after connecting the CDN. If these indicators have not improved but worsened, you should be looking elsewhere.
There is no need to use a content delivery network for small companies whose target audience is concentrated within one region, and the site does not have a large volume of "heavy" static data (images, video, audio, etc.).
In cases such as this, the problem of slow loading is solved by carrying out technical work on the site itself. The reasons for the slow speed may be:
You can check your site's loading speed using the Labrika report "Speed and Usability,". This shows an assessment of speed indicators and gives recommendations on their optimization.