Use it to reduce latency and origin load, absorb traffic spikes and DDoS, terminate TLS and HTTP/3 at the edge, and run WAF rules before traffic reaches your servers.
Content Delivery Networks
A content delivery network (CDN) is a distributed set of edge servers that terminate client connections close to users, cache responses, and forward the rest to your origin.
1. Is traffic actually going through the CDN (DNS)?
2. HIT or MISS at the edge?
3. Does the origin answer correctly when reached directly?
4. Is the 5xx generated by the CDN (origin unreachable/timeout) or passed through from the origin?
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
dig +short CNAME www.example.comVerification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Read-only Verification Verify boundary
# Does the name point to the CDN?
dig +short CNAME www.example.com
dig +short www.example.com
# Edge response: cache headers and provider identification
curl -sSI https://www.example.com/assets/logo.svg | grep -iE '^(age|cache-status|x-cache|via|server|cf-cache-status|cache-control)'
# Same request straight to the origin (bypass the CDN)
curl -sSI --resolve www.example.com:443:203.0.113.10 https://www.example.com/assets/logo.svg
# Can the origin be reached directly from the internet? (should fail if protected)
curl -sS -m 5 -o /dev/null -w "%{http_code}\n" --resolve www.example.com:443:203.0.113.10 https://www.example.com/
A HIT with a growing Age means the edge served the object. If the origin answers the last command from an arbitrary network, origin protection is missing.
Step 2 Common mistakes Narrow the fault
Step 3 Troubleshooting Narrow the fault
Site down only through the CDN. Origin firewall blocks new CDN ranges, origin certificate invalid or expired for CDN validation, or the CDN times out waiting for the origin. The CDN's error page or code usually names which.
Stale content after a deploy. Long edge TTLs on unversioned URLs; purge, then fix headers or move to versioned filenames.
All visitors logged with the same few IPs. Real-IP handling not configured at the origin.
Redirect loop. CDN connects to the origin over HTTP while the origin redirects to HTTPS. Use TLS to the origin or make the application trust X-Forwarded-Proto from the CDN.
The CDN is now part of your HTTP path: it has its own cache rules, timeouts, TLS certificates and logs. The origin sees CDN IPs — use the provider's client-IP header and trust it only from CDN ranges. Lock the origin so it cannot be reached around the CDN.
dig +short <host>/dig +short CNAME <host>— does the name point at the CDN?curl -sSI https://<host>/— CDN headers: Age, Cache-Status or provider cache header, Via, Server.curl -sSI --resolve <host>:443:<origin-ip> https://<host>/— origin response without the CDN.- Provider dashboard: cache hit ratio, origin errors (5xx), purge history.
ReferenceWhat it is2 sections · depth on demand
Direct Answer
A CDN puts edge servers (points of presence, POPs) between your users and your origin. DNS or anycast sends each client to a nearby edge, which terminates TLS, applies security rules, serves cached responses and forwards cache misses to the origin. You control what is cached with HTTP headers and CDN rules, remove stale objects with purge, and protect the origin so that only the CDN can reach it. When something breaks, first decide whether the edge or the origin produced the response.
Scope and canonical references
- Cache semantics the CDN follows: HTTP Caching.
- Edge application firewall: WAF.
- HTTP/3 at the edge: HTTP/3 and QUIC.
- Origin-side proxying and real client IP: Reverse Proxy.
ReferenceImportant terms & boundaries1 section · depth on demand
In depth
How traffic reaches the edge
- DNS-based: your hostname is a CNAME to the CDN; the CDN's DNS returns an edge IP close to the resolver (or the client subnet).
- Anycast: the same IP is announced from every POP; BGP routes clients to the nearest one.
Apex domains cannot be a CNAME; providers offer ALIAS/flattening records or anycast IPs for them.
Edge caching
The CDN honours Cache-Control and s-maxage from the origin unless rules override them. CDN-Cache-Control (RFC 9213) lets the origin give the CDN a different lifetime than browsers. Cache keys normally include host, path and query string; ignoring irrelevant query parameters and limiting Vary raise the hit ratio. Purge (by URL, tag/surrogate key or everything) removes objects; versioned asset URLs avoid needing it.
An origin shield (tiered cache) adds one regional cache layer, so a miss in many POPs becomes a single request to the origin.
TLS
The edge presents a certificate for your hostname (CDN-managed or uploaded). The CDN-to-origin leg should also use TLS with certificate validation — "flexible" modes that talk plain HTTP to the origin create redirect loops and expose traffic.
Client IP and headers
The origin sees CDN addresses. The real client IP arrives in X-Forwarded-For or a provider-specific header. Configure the web server to replace the remote address only when the request comes from published CDN ranges (nginx set_real_ip_from + real_ip_header, Apache mod_remoteip), otherwise any client can spoof its IP.
Origin protection
If the origin is reachable directly, attackers bypass the WAF and caching. Options: allow only CDN IP ranges in the firewall, authenticated origin pulls (mTLS from CDN to origin), a secret header checked at the origin, or a private tunnel from origin to CDN.
Errors
CDNs generate their own error pages for origin connection failures and timeouts (often 502, 503, 504 or provider-specific 52x codes). Compare with the origin's access log: no log entry means the request never reached the origin.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.