Key takeaways
- A CDN serves files from servers close to each visitor.
- It reduces load on your origin and absorbs traffic spikes.
- Never cache personalised pages like carts and account areas for everyone.
A content delivery network (CDN) is a group of servers spread around the world that keep copies of your website’s files. Visitors download those files from a server near them instead of from your origin server, which may be on another continent.
What a CDN does
- Shortens the distance. Every request has to travel over the network; serving from nearby cuts the round-trip time.
- Caches static files. Images, stylesheets, scripts and fonts are stored at the edge, so your server handles far fewer requests.
- Absorbs spikes. A sudden burst of traffic is spread across the CDN rather than hitting one server.
- Adds protection. Many CDNs filter malicious traffic and mitigate denial-of-service attacks.
- Handles HTTPS efficiently, often with modern protocols such as HTTP/3.
How it works
Visitor in Riyadh → nearest CDN edge
├─ cached? → served immediately
└─ not cached → edge fetches from your origin, stores a copy, serves it
Do you need one?
A CDN helps most when:
- Your visitors are spread across countries or continents.
- Your pages are heavy with images or video.
- You expect traffic spikes — launches, campaigns, sales.
For a small local business whose visitors are near the server, a CDN is a smaller win, though still useful for protection and caching.
Things to watch
- Cache rules. Dynamic pages (carts, account areas) must not be cached for everyone.
- Purging. After updating files, purge the CDN cache so visitors get the new version.
- SSL mode. Make sure the CDN connects to your origin over HTTPS to avoid redirect loops.