# CDN (Content Delivery Network)

URL: https://softwaredictionary.org/terms/cdn
Category: DevOps & Cloud
Last updated: 2026-09-29

In short: A CDN is a network of servers spread around the world that stores copies of website content and delivers it to each user from the nearest location.

## What is a CDN?

A CDN, or content delivery network, is a group of servers in many locations, often called edge servers or points of presence, that deliver web content to users. Instead of every visitor loading files from one origin server, each visitor gets them from a nearby CDN server, which makes pages load faster.

CDNs work by caching. The first time someone in a region requests a file, such as an image, a JavaScript bundle, or a video segment, the edge server fetches it from the origin and keeps a copy, and later visitors nearby receive that cached copy directly. HTTP headers such as `Cache-Control` tell the CDN how long each file may be stored.

Think of a CDN like a chain of local warehouses: instead of shipping every order from one central factory, popular products are stocked close to customers so deliveries arrive faster. Beyond speed, CDNs reduce load on the origin server, absorb traffic spikes, help protect against DDoS attacks, and handle HTTPS connections close to the user.

A CDN does not replace your web server or hosting; the origin still holds the original content and runs your application logic. Many modern CDNs also offer edge computing, which runs small pieces of code on the edge servers themselves, blurring the line between a CDN and a serverless platform.

## Key takeaways

- A CDN serves content from servers close to each user.
- It works by caching copies of files from the origin server.
- CDNs reduce latency, lower origin load, and help absorb traffic spikes and attacks.
- `Cache-Control` headers control how long content is cached.
- Many CDNs can also run code at the edge.

## Example: Checking whether a file came from the CDN cache

```bash
# Show only the response headers for a file served through a CDN
curl -I https://cdn.example.com/images/logo.png

# Typical headers in the response:
# cache-control: public, max-age=31536000, immutable  (cache for up to a year)
# age: 3600                                           (seconds spent in the cache)
# x-cache: HIT                                        (served by the edge, not the origin)
```

## Frequently asked questions

**Do I need a CDN for my website?**

A CDN helps most when your visitors are spread across different regions or your site serves many images, scripts, or videos. Many hosting platforms include a CDN automatically, so you may already be using one.

**What is the difference between a CDN and web hosting?**

Web hosting stores your site and runs its application code on an origin server. A CDN sits in front of that server and delivers cached copies of the content from locations close to your users.

**What is a cache hit in a CDN?**

A cache hit means the CDN edge server already had a stored copy of the requested file and served it directly. A cache miss means it had to fetch the file from the origin server first.

---

Software Dictionary: https://softwaredictionary.org/ · https://softwaredictionary.org/llms.txt
