BF50 Black Friday · 50% off all plans
from $5/mo · Auto-applied ---:--:-- Claim 50% off →
Skip to content

Search Seonio

Type a keyword, domain, or paste a URL

Start free with $1 to see full results. Powered by Seonio
Web Development

Content delivery network (CDN): How it works

A content delivery network (CDN) serves your site's files from servers near each visitor, so pages load faster and your own server does less work.

Monthly searches · content delivery network
22.2k
Keyword research data
content delivery network
Content delivery network (CDN): How it works
Click the image to view it full size

A content delivery network (CDN) is a network of servers in many locations that sits between your web server and your visitors. Your own server, called the origin, still holds the real site. The CDN keeps copies of your files and serves each visitor from a location near them, so the files travel a shorter distance.

Say your site is hosted in Germany and a visitor opens it in Australia. Without a CDN, every request crosses the globe. With one, most files come from a server in Australia.

How a request goes through a CDN

  1. You point your domain at the CDN. Usually you change a DNS record (a CNAME) so requests for your site reach the CDN first.
  2. The CDN checks its cache. If it already has a fresh copy of the file, it serves it straight away. That's a cache hit.
  3. On a miss, it asks your server. The CDN fetches the file from the origin, sends it to the visitor and keeps a copy for the next one.
  4. Your caching rules decide how long copies last. The Cache-Control headers your server sends tell the CDN what it may store and for how long. When a page changes early, you purge it from the CDN.

Even pages that can't be cached, such as a shopping cart, often load faster through a CDN, because its network connections back to your server are optimized.

What a CDN does for speed and SEO

The main gain is faster loading. A CDN can cut time to first byte significantly, and that helps Largest Contentful Paint, the Core Web Vitals metric for loading. web.dev

Google recommends good Core Web Vitals and says they align with what its core ranking systems reward. A CDN helps there through speed: it's one of the most direct ways to make pages load faster for people far from your server. Google Search Central

A CDN also changes how Google crawls you:

  • Faster crawling. Google allows higher crawl rates for a CDN-backed site, because it assumes the site can handle more requests at once.
  • Cold caches. The first time any URL is requested, the CDN doesn't have it yet, so your origin must serve it at least once. If you launch a large site, expect heavy load on your own server for the first days of crawling.

Beyond speed, CDNs absorb traffic spikes, reduce the load and bandwidth on your server, and often include protection against attacks.

When a CDN can hurt your search visibility

The same protection that blocks attacks can block search engine crawlers. Google describes what goes wrong in its post on CDNs and crawling:

  • Timeouts. If the CDN doesn't answer a crawler at all, Google can drop the affected URLs from its index and slow its crawling.
  • Error pages sent with a 200 status. Google may treat them as errors and drop the pages, or see many identical pages and drop them as duplicates.
  • "Are you human?" checks. A crawler sees only the challenge, not your page. Google recommends that the CDN send a 503 status to crawlers in this case, which signals a temporary problem.

To check, run a page through the URL Inspection tool in Google Search Console and look at the rendered result. If it shows an error or a challenge instead of your page, adjust your CDN's firewall or bot settings. Google publishes its crawlers' IP ranges, so you can allow them on purpose.

Setting one up well

  • Serve the whole site if you can, not only images and scripts. web.dev recommends this, because a faster HTML document speeds up everything that follows.
  • Set clear cache rules. Long cache times for files that rarely change, such as images and versioned CSS. Short ones, or none, for personalized pages.
  • Never cache private pages. Logged-in pages and carts must not be stored and shown to the next visitor.
  • Purge when you publish. Otherwise visitors may see the old version until the cache expires.
  • Check third-party files. When you load a script from someone else's CDN, add a Subresource Integrity hash so the browser rejects a file that has been changed.
  • Include it in your privacy checks. A CDN processes every visitor's IP address, so include it when you review your site against the GDPR and similar laws.

A CDN doesn't replace web hosting. Your origin server still runs the site, the database and anything dynamic. The CDN makes delivering it faster and steadier.

Seonio

Put it to work on your own site

Keyword research, traffic, backlinks and clustering in one place. Start with a free $1 to test, no card required.