A content delivery network (CDN) is a network of servers spread around the world. Instead of every visitor downloading your images and pages from one server in one data centre, they get them from a nearby CDN location. The result: faster pages and less load on your server. It is one of the most effective items on our website speed checklist.
How it works
- Your domain points to the CDN (via nameservers or a DNS record).
- The first visitor near a CDN location gets the file from your server, and the CDN keeps a copy.
- Next visitors in that region get the copy directly from the CDN.
- Copies expire based on your cache settings, or when you purge them.
Benefits
- Speed: shorter distances and modern protocols. See Core Web Vitals.
- Stability: traffic peaks hit the CDN, not your server.
- Security: many CDNs filter attacks and offer a web application firewall. See DDoS protection.
- Lower bandwidth on your hosting plan (see bandwidth myths).
Caching basics
| Content | Typical cache time |
|---|---|
| Images, fonts, CSS and JS with versioned names | Weeks to a year |
| HTML of static pages | Minutes to hours, or purge on publish |
| Cart, account, admin pages | Never cache |
Frequently asked questions
Does a CDN help if all my visitors are in Belgium?
Less for distance, but a CDN still offloads your server, adds HTTP/3 and compression, absorbs traffic spikes and filters attacks.
Can a CDN break my website?
Wrong caching settings can show outdated pages or cache personal content like shopping carts. Exclude logged-in and dynamic pages from caching, and know how to purge the cache.