A CDN, or content delivery network, is a geographically distributed group of servers that caches copies of your website's content close to your visitors. Instead of every request travelling to one origin server, the CDN serves cached files from a nearby edge server, which cuts load times, reduces bandwidth costs and absorbs traffic spikes and DDoS attacks.
Key takeaways
- A CDN caches static content on edge servers worldwide so visitors load your site from nearby, not from one origin.
- Beyond speed, a CDN adds DDoS protection, hides your origin server and can enforce TLS and a web application firewall.
- Most small sites can start on a free CDN plan; the main work is DNS setup and getting caching rules right.
Open a website hosted on the other side of the world and it still loads in a second or two. That is not because the internet got faster — it is because a copy of that site is probably sitting on a server near you. That network of nearby servers is a CDN.
What is a CDN?
A content delivery network (CDN) is a geographically distributed group of servers that caches content close to end users. Instead of every visitor fetching files from one origin server, the CDN serves them from an edge server nearby, which makes pages load faster and reduces the load on your origin.
The files a CDN caches are the assets a page needs: HTML pages, JavaScript, stylesheets, images and video. Cloudflare's CDN guide describes its purpose simply: fast delivery of internet content, achieved by placing servers at internet exchange points where different networks connect, and by caching content at the edge.
A CDN is not web hosting. Your hosting runs the application, stores the authoritative data and generates responses. The CDN is a reverse proxy in front of it: it accepts visitor connections, serves what it can from cache, and forwards the rest to your origin.
Two terms explain the setup. The origin is your main server, where the website's files live. An edge server is a server in the CDN's network that handles visitor requests and can deliver cached copies. A group of edge servers in one location is called a point of presence (PoP).
How does a CDN work?
When a visitor requests your site, DNS routes them to the CDN rather than directly to your origin. The CDN directs the connection to a suitable edge location — usually the one with the lowest latency, not always the geographically closest — and the edge server checks whether it has a fresh cached copy of the requested file.
If it does, that is a cache hit: the edge serves the file immediately, and your origin never hears about the request. If it does not, that is a cache miss: the edge fetches the file from your origin, serves it, and stores a copy for the next request. Amazon's CloudFront guide explains the same flow: requests route to the edge location nearest the user with the lowest latency.
CDNs also optimize the connection itself. They terminate TLS at the edge, reuse connections to the origin, and route traffic over their own high-speed backbone networks. Amazon's CloudFront, for example, delivers content through edge locations connected by the AWS global network, which reduces latency and improves the application's security posture.
Caching decisions are driven by response headers and the provider's rules, such as time-to-live (TTL) values. When you update content, cached copies become stale until they expire or you purge them. Most providers let you purge by URL, by tag or across the whole site — and a purge is one of the first things to check when visitors see an old version of a page.
Why use a CDN? The benefits
Speed is the headline benefit. Shorter distances mean lower latency, and latency is what users feel most: a page that loads in one second instead of four keeps more visitors and ranks better in search. For image-heavy sites, shops and media, the difference is dramatic.
Reliability is the second benefit. A CDN spreads requests across many servers, so if one edge server fails, traffic routes to another. If your origin goes down briefly, the CDN can keep serving cached content. Traffic spikes — a product launch, a viral post, a sale — are absorbed by the edge network instead of overwhelming your server.
Cost is the third. Every request the edge answers is one your origin does not have to serve, which cuts hosting bandwidth and CPU usage. For high-traffic sites, that saving alone can pay for the CDN.
Security is the fourth, and the one this site cares about most. A CDN hides your origin server's IP address, absorbs volumetric DDoS attacks across its network, and can add a web application firewall, bot management and TLS enforcement in front of your site. You can read more about the security side in our guide to securing your home network — different setting, same principle of layers.
How does a CDN improve security?
A CDN sits between attackers and your origin, and that position gives it several security advantages. First, scale: a CDN's network can absorb attack traffic that would crush a single server. CloudFront, for example, integrates with AWS Shield and AWS WAF to protect against network and application layer DDoS attacks.
Second, concealment: when the CDN proxies your traffic, your origin's real IP address is not exposed in DNS. Attackers who cannot find the origin cannot attack it directly — though this only works if you also block direct access to the origin, which many sites forget to do.
Third, filtering at the edge: a web application firewall can block common attacks such as SQL injection and cross-site scripting before they reach your application, and bot management can challenge automated traffic. TLS is terminated at the edge, so the CDN can enforce modern protocols and ciphers even if the origin is older.
None of this replaces securing the origin itself. A CDN is one layer. Your origin still needs patching, strong authentication and proper configuration — a CDN in front of an unpatched server is a faster unpatched server.
Check your public TLS setup with our free SSL checker.
You can also test your headers with the security headers checker.
CDN vs hosting vs DNS vs VPN: what is the difference?
These four are often confused because they all sit between you and a website. They do different jobs, and most sites use several of them at once.
| What it does | Where it sits | Example | |
|---|---|---|---|
| CDN | Caches and delivers content from edge servers | In front of your origin | Cloudflare, CloudFront, Fastly |
| Web hosting | Runs your site and stores its data | The origin itself | A VPS, shared host or cloud server |
| DNS | Translates domain names to IP addresses | Before any connection | Route 53, Cloudflare DNS |
| VPN | Encrypts your connection and hides your location | On the visitor's device | A consumer VPN app |
A CDN uses DNS to route visitors to the edge, and it needs hosting behind it. A VPN protects the visitor's connection, not the website. If someone offers you a VPN as a way to speed up your website, they are selling you the wrong product.
What types of CDN are there?
CDNs differ mainly in what they deliver. A static CDN caches files that rarely change: images, CSS, JavaScript and downloads. This is the most common use and the easiest to set up, because the same file can be served to everyone.
A dynamic CDN accelerates content that changes per user, such as API responses and personalized pages. It cannot cache those responses for everyone, but it still helps through optimized routing, persistent connections to the origin, and edge compute — small functions that run at the edge, such as CloudFront Functions or Lambda@Edge, which can rewrite URLs, add headers or handle redirects without touching the origin.
A video and streaming CDN is tuned for large media: it segments video, caches the popular segments at the edge, and adapts quality to the viewer's connection. Live streaming adds its own requirements, such as low-latency ingest and real-time transcoding.
There are also multi-CDN setups, where a site uses two or more providers for redundancy and to pick the fastest route per region. That is usually overkill for a small site, but large platforms use it to survive a provider outage.
How do you choose a CDN?
Start with where your visitors are. If they are all in one country, a CDN with strong coverage there matters more than a global network. If they are worldwide, look for providers with points of presence in your key regions — CloudFront, for example, operates more than 600 points of presence across 50 countries.
Then check the free tier honestly. Cloudflare's free plan includes unlimited bandwidth for proxied traffic and is genuinely enough for many small sites. Other providers charge by bandwidth and requests, which can be cheap at low volume and expensive at high volume. Estimate your monthly traffic before comparing prices, and watch for charges on requests, not just bandwidth.
Look at the security features on the plan you would actually buy, not the top tier. DDoS protection is usually included, but a web application firewall, bot management and advanced rules are often paid add-ons. If security is your main reason for a CDN, price the plan that includes the features you need.
Finally, consider how the CDN is set up. The most common setup is to change your domain's nameservers to the provider, or to point a DNS record at the CDN. Both are simple, but both can take your site offline if done wrong — so make the change at a quiet time, keep your old DNS settings, and test with the DNS lookup tool afterward.
Common CDN mistakes to avoid
The most common mistake is caching something that should never be cached. Logged-in pages, shopping carts and anything containing personal data must bypass the cache, or one visitor may see another's content. Set cache rules per path, and default to bypassing the cache for anything dynamic.
The second is forgetting to purge after an update. Visitors keep seeing the old page, the team blames the website, and the fix is a cache purge. Build purging into your deployment process so it happens automatically.
The third is leaving the origin exposed. If your origin server still accepts direct connections, attackers can bypass the CDN entirely. Restrict the origin so it only accepts traffic from the CDN's IP ranges, and use authenticated origin pulls where your provider supports them.
The fourth is misconfigured TLS. If the CDN talks to your origin over plain HTTP, the encryption stops at the edge and the last hop is exposed. Use full strict TLS between the CDN and your origin, with a valid certificate on the origin too.
The bottom line
A CDN is a network of edge servers that caches your content close to your visitors. It makes your site faster, more reliable and cheaper to run, and it adds a useful security layer in front of your origin — DDoS absorption, origin concealment and edge filtering.
Most small sites can start free and upgrade only when traffic or security needs demand it. Set it up carefully, get your cache rules right, and keep the origin locked down. Then verify the result with the free SSL checker to confirm your site's TLS is solid behind the CDN.
Frequently asked questions
What is a CDN in simple terms?
A CDN is a network of servers around the world that stores copies of your website's files. When someone visits your site, they get those files from the nearest server instead of from your single main server, so the page loads faster.
Do I need a CDN for a small website?
Not always, but most small sites benefit. If your visitors are in more than one country, your pages include large images or video, or you worry about traffic spikes and DDoS attacks, a CDN helps. Many providers offer a free plan that is enough for a small site.
Is a CDN the same as web hosting?
No. Web hosting is where your website's files and application live and where pages are generated. A CDN sits in front of your hosting and delivers cached copies of content from edge servers. You still need hosting; the CDN does not replace it.
Does a CDN make my website more secure?
Yes, in several ways. A CDN can absorb DDoS traffic, hide your origin server's real address, enforce HTTPS, and add a web application firewall and bot filtering. It is not a replacement for patching and secure configuration, but it is a strong layer.
What is an edge server?
An edge server is a server in the CDN's network, located in a data center called a point of presence, close to groups of users. It handles visitor requests and serves cached content, contacting your origin server only when it needs fresh content.
What is the difference between a CDN and a cache?
Caching is the technique of storing copies of files for reuse. A CDN is a distributed system built around caching: it places caches on edge servers worldwide. Your browser also caches files, but only for you, while a CDN caches them for all visitors in a region.
Can a CDN serve dynamic content?
Yes, but differently. Static files such as images and stylesheets are cached at the edge. Dynamic content such as a logged-in dashboard is usually fetched from the origin, though the CDN can still speed it up with optimized routing, connection reuse and edge compute.
How much does a CDN cost?
Many providers have a free tier for small sites, including Cloudflare's free plan. Paid plans usually charge by bandwidth and requests, or a flat monthly fee. Costs depend on your traffic volume, which regions your visitors are in, and which security features you enable.
Sources
The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.
Checked against Cloudflare's CDN learning guide and Amazon's CloudFront documentation.
How we write and fact-check →