How a CDN works
When a browser requests a page, DNS often directs it to the CDN rather than straight to the website’s origin server. The CDN selects an available edge server, often based on network location, server health and current traffic.
Browser → CDN edge → cached response
→ origin server on a cache miss
The edge checks for a cached response using a cache key, usually based on the URL and sometimes selected headers, cookies or query parameters. A cache hit is returned from the edge. On a miss, the edge requests the content from the origin, sends it to the browser and may store a copy. Headers such as Cache-Control, Expires and Vary help control how long and under which conditions content is cached.
What a CDN does
- Shortens delivery paths: Nearby edge servers can reduce latency for images, scripts, stylesheets and video.
- Reduces origin work: Cached responses save the origin from processing every request.
- Manages traffic spikes: A CDN can spread client traffic across edge servers and absorb cacheable demand. Origin protection still depends on caching and the origin architecture because cache misses and dynamic requests may reach the origin.
- Applies request controls: Many CDNs offer DDoS filtering, a web application firewall and rate limiting.
Dynamic or personalized responses often pass through to the origin, though the CDN can still optimize routing and connections.
CDN vs reverse proxy
A CDN often uses reverse proxies at geographically distributed edges, but the terms aren’t synonymous. A reverse proxy is a traffic-handling component, while a CDN is a distributed content-delivery system.
| Aspect | CDN | Reverse proxy |
|---|---|---|
| Deployment | Many edge locations | Single or distributed deployment |
| Main purpose | Deliver content across regions | Manage incoming traffic |
| Caching | Usually a core function | Optional |
How CDNs affect proxy traffic
A CDN sees your proxy’s exit IP instead of your direct IP. It may use IP geolocation to select an edge or serve region-specific content. Two proxies can therefore reach different edge caches or receive different localized pages from the same URL.
A 403 response or 429 response may come from the CDN or its firewall. A 502 or 504 can mean the edge couldn’t get a valid or timely response from the origin. When collecting public data, follow the site’s terms and robots.txt, reduce your request rate and honor Retry-After instead of rotating IPs to evade controls.
FAQ
Is a CDN the same as a reverse proxy?
No. A CDN often uses reverse proxies at geographically distributed edges, but the terms aren’t synonymous. A reverse proxy is a traffic-handling component, while a CDN is a distributed content-delivery system.
Can a proxy bypass a CDN cache?
No, not reliably. A different proxy IP may send you to another edge, but the website’s CDN rules still decide whether to return cached content or contact the origin.
Why does a CDN return 403 or 429?
A 403 means the CDN, its firewall or the website refused the request. A 429 means a rate limit was reached, so slow down and follow any Retry-After header.