How does a CDN deliver a page?
You point a hostname such as static.shop.example (or the whole site) at the CDN, usually with a CNAME or by moving DNS to the network. When a browser in Lisbon asks for /img/hero.webp, the request lands on an edge node in or near Lisbon. If that node already holds a fresh copy, it answers straight away. If not, it fetches the file from your origin, stores it according to the cache rules, and serves the next Lisbon visitor from memory or local disk. Your machine sees one request where it would otherwise have seen thousands.
What problems does a CDN solve, and which ones does it leave?
- Distance: a round trip from Southeast Asia to Phoenix costs well over 150 ms; an edge hit in the same region costs a few. Images, scripts, fonts and video segments benefit most.
- Outgoing traffic: every byte served by the edge is a byte that does not count against your monthly allowance. That matters most in Singapore, where the allowance is 5 TB rather than 15 TB.
- Bursts: a sudden spike from a link on a busy forum hits the cache, not your PHP workers.
- What stays on the origin: logins, carts, search results, API calls with personal data and anything marked private still travel to your server on every request. A CDN does not make slow database queries faster.
What do the main CDN terms mean?
| Term | Meaning |
|---|---|
| Origin | Your own server, the source of truth for every file |
| Edge or PoP | A caching location run by the CDN close to visitors |
| Hit ratio | Share of requests answered from cache; 90 percent or more is normal for static assets |
| Purge | Telling the edges to drop a cached object before it expires |
| Origin shield | A middle cache layer that collapses misses from many edges into one fetch |
| Cache key | The parts of a request (host, path, some query strings) that identify a stored copy |
How should an origin server send cache headers?
The CDN mostly obeys what your origin says. Versioned assets whose names change on every build can be cached for a year; HTML should be cached briefly or not at all. With nginx, a pair of location blocks covers most sites:
location ~* \.(?:css|js|woff2|webp|avif|svg)$ {
add_header Cache-Control "public, max-age=31536000, immutable";
access_log off;
}
location / {
add_header Cache-Control "public, max-age=60, stale-while-revalidate=300";
try_files $uri /index.php$is_args$args;
}
Check the result with curl -sI https://shop.example/app.4f1c.js | grep -i cache-control. Any response that sets a cookie should normally be marked private so it never lands in a shared cache. Cache explains the layers between a browser and a disk.
Does a CDN hide or protect the origin?
It helps, but only if you close the side door. Visitors resolve the CDN address, yet anyone who learns your origin IPv4 can still reach it directly. Restrict ports 80 and 443 on the machine to the CDN ranges the provider publishes, and keep SSH limited to your own addresses. Our machines also sit behind edge DDoS filtering on the network, described on Edge DDoS filtering, which handles floods aimed at the address itself.
How do I see whether a request was a cache hit?
Most networks add a response header that reports the cache status, often named X-Cache or something similar, plus an Age header counting seconds since the copy was stored. Request the same asset twice and compare: curl -s -o /dev/null -D - https://static.shop.example/logo.svg | grep -iE '^(age|x-cache)'. A growing Age value means the edge is serving its own copy. On the origin, watch the access log while you do this; a hit never shows up there at all, which is the simplest proof the setup works.
When is a CDN not worth it?
For an internal tool used from one office, an API that returns unique data per request, or a game server speaking UDP, a web CDN adds a hop and saves little. The same goes for a site whose visitors are concentrated near one of our cities: pick that city for the machine and you may get most of the latency gain without another service. Latency has typical numbers.
What does a good origin for a CDN look like?
Fast storage for cache misses, enough RAM to keep hot files in the page cache, and a fat port so that refills after a purge finish quickly. The S1 with 1x 1 TB NVMe and 2x 10 Gbps covers most small shops, while a media library that refills often suits the S11 with 2x 2 TB NVMe. Video streaming and Media servers size larger libraries.
Origin Servers With Fast NVMe Storage
| Server | Processor | Cores / threads | Memory | Storage | Network | Per month | Smallest order |
|---|---|---|---|---|---|---|---|
| S1 | Intel Xeon E-2276G | 6 / 12 | 64 GB DDR4 | 1x 1 TB NVMe | 2x 10 Gbps | $53.32 | $53.32 (1 month) |
| S3 | Intel Xeon E-2356G | 6 / 12 | 64 GB DDR4 | 2x 1 TB NVMe | 2x 10 Gbps | $80.38 | $80.38 (1 month) |
| S11 | Intel Core i9-14900K | 24 / 32 | 128 GB DDR5 | 2x 2 TB NVMe | 2x 10 Gbps | $149.39 | $149.39 (1 month) |
| S12 | Intel Core i9-14900K | 24 / 32 | 192 GB DDR5 | 2x 4 TB NVMe | 2x 10 Gbps | $202.82 | $202.82 (1 month) |
Keep Reading
Cache
Caching at every layer of a server, from CPU L1 to the page cache to application caches, and how each one makes the box faster.
OpenLatency
Why distance sets the floor for ping time, how to estimate round trips between our six cities and how to choose a location.
OpenOutbound traffic allowance
How the 15 TB monthly egress allowance works, what it means per day and per second, and why inbound data costs nothing.
OpenVideo streaming
Live and on-demand video with fast ports, NVMe for segments and a clear bitrate-to-terabyte budget per month.
OpenFAQ
Quick Answers
Not always. It pays off when visitors are spread across continents or when static files make up most of your outgoing traffic.
Yes. Requests answered from the edge cache never reach your machine, so they do not count against its monthly outgoing allowance.
You can route them through it, but personal or per-user pages should be marked private and will be fetched from your origin every time.
Allow web ports on the origin only from the address ranges your CDN publishes, and block everything else in the host firewall.
Use versioned file names so new builds get new URLs, or purge the changed paths. HTML with a short max-age refreshes on its own.