CDN definition
A content delivery network (CDN) is a globally distributed network of servers that caches and delivers web content, such as images, scripts, videos and pages, from locations close to each user. By shortening the distance data travels and absorbing traffic, a CDN makes websites faster, reduces load on origin servers and helps protect against attacks.
How does a CDN work?
A CDN operates points of presence, clusters of servers in many cities around the world. When a user requests a file, DNS or anycast routing sends the request to a nearby location. If that edge server has a fresh copy in its cache, it responds immediately. If not, it fetches the file from the origin server, returns it to the user and stores it for the next visitor, for as long as the caching headers allow.
Consider a site hosted in a data center in the United States and a visitor in Mumbai. Without a CDN, every image, script and page crosses the world, adding noticeable delay to each request. With a CDN, most of those files come from a server in or near India, so the page renders faster and the origin handles a small fraction of the traffic. Tiered caching adds regional layers to reduce origin requests further.
What a CDN does beyond caching
- Static asset delivery: images, CSS, JavaScript and fonts.
- Full-page caching for static and semi-static HTML.
- Video streaming and large file downloads.
- Image optimization: resizing and converting to WebP or AVIF on the fly.
- TLS termination with modern protocols such as HTTP/2 and HTTP/3.
- DDoS protection, web application firewalls and bot management.
- Edge compute for redirects, authentication checks and personalization.
Popular CDN providers
Cloudflare, Akamai, Fastly and Amazon CloudFront are among the most widely used CDNs, alongside Google Cloud CDN, Azure Front Door and lower-cost options such as Bunny.net. Hosting platforms such as Vercel and Netlify include a CDN automatically. Providers differ in network coverage, pricing for bandwidth and requests, security features, edge compute capabilities and how quickly cached content can be purged.
How to set caching rules safely
Caching is controlled mainly through HTTP headers. Static assets with content hashes in their filenames can be cached for a year and marked immutable, since a new deploy produces new filenames. HTML usually gets short lifetimes, or stale-while-revalidate so users get a fast cached copy while the CDN fetches a fresh one. Purge APIs remove content instantly when an editor publishes a change.
The biggest risk is caching something personal. A page that includes a user's name, cart or account details must never be stored in a shared cache, or one visitor may see another's data. Mark such responses private or no-store, be careful with cookies and cache keys, and test caching behavior before launch.
CDN benefits for performance and SEO
A CDN lowers server response time and speeds up the largest content on a page, both of which feed Core Web Vitals. It also keeps sites available during traffic spikes and origin outages, reduces bandwidth bills and blocks large-scale attacks before they reach your servers. Nexzem configures CDNs with explicit caching rules per route, security settings and real-user monitoring, so speed gains can be measured in the field.