Learn
Cache-Control max-age vs s-maxage: Browser and CDN TTLs
Verdict, evaluated November 2026: set max-age for the browser and s-maxage for the CDN, and keep them deliberately ...
To build your own CDN you need four working layers: caching proxies such as Nginx or Varnish on NVMe servers in each region, a request-routing layer (GeoDNS or BGP anycast), an origin shield, and monitoring. The arithmetic is unforgiving. 100 TB a month averages about 309 Mbps, and the 95th percentile peak is typically 2 to 3 times that, so every region needs headroom for roughly 1 Gbps plus failover capacity. This guide gives you the reference architecture, a six-step setup, diagnostics and rollback, a worked build-versus-buy cost model, and the pitfalls that sink most projects.
As of 2026, a self-built CDN serving 100 TB a month costs roughly $11,000 to $14,000 a month once servers, DNS, monitoring and half an engineer are counted (this blog's estimate). Engineering time is more than half of that bill, and it does not shrink when traffic does. A two-region proof of concept takes one or two days. A production network with failover, purging and on-call coverage takes weeks to months.
Picture the architecture diagram as three horizontal tiers. At the bottom sits your origin: object storage or application servers holding the canonical files. Above it, one or two shield nodes collapse cache misses so the origin sees a single request per object per shield. At the top, edge PoPs in each target region terminate TLS, serve hits from NVMe, and forward misses to the shield. A routing layer sits beside the edges and steers each client to a healthy PoP, while a control plane pushes configuration, certificates and purges to every node.
Four open-source proxies cover almost every custom CDN build. The choice matters less than how well your team can debug it at 3 a.m.
Setting up a CDN means placing caching servers in the regions where your users are, routing each user to the nearest healthy server, and protecting your origin with a shield tier. The steps below assume Nginx at the edge and work the same with Varnish. Each step names the setting and why it exists.
Start from your traffic logs, not a world map. Two to four regions usually cover more than 80% of requests for a regional business. Rent dedicated servers with NVMe and bandwidth-included ports rather than hyperscaler VMs: internet egress from AWS, Google Cloud or Azure runs roughly $0.05 to $0.09 per GB in 2026 (estimate, depending on tier), which turns 100 TB into a $5,000 to $9,000 egress bill before any compute.
In Nginx, define a cache zone with proxy_cache_path, sized to about 80% of the NVMe volume, with a keys_zone large enough for your object count. Enable proxy_cache_lock so concurrent misses for one object trigger a single upstream fetch. Set proxy_cache_use_stale for error, timeout and updating states, and turn on proxy_cache_background_update so expired objects refresh without blocking clients. Keep the cache key minimal: host plus path, with query strings stripped unless they change the response.
Point every edge at the shield, and only the shield at the origin. Use TLS between tiers, keepalive connections to upstreams, and an origin allow-list containing only shield IPs. Give the origin a secondary target (a replica bucket or a second region) so the shield can fail over without edge changes.
GeoDNS is the faster path: a managed DNS provider maps resolver location to the nearest PoP and removes unhealthy PoPs through health checks. Its weakness is that it sees the resolver, not the client, unless the resolver sends EDNS Client Subnet (RFC 7871). Anycast announces one IP prefix from every PoP and lets BGP pick the path. It needs your own ASN, a /24 of IPv4 space, and transit providers willing to accept your announcements, and it can steer traffic to a distant PoP when upstream routing is odd.
Put HAProxy or Nginx in front of the cache nodes and hash on the request URI so each object lives on one node, which raises the effective hit ratio. Automate certificate issuance and push certificates through the control plane. Enable TLS 1.3, HTTP/2 and session resumption.
Respect origin Cache-Control headers and set defaults per content type: long TTLs with versioned filenames for immutable assets, short TTLs for manifests and HTML. Build purge as an API that fans out to every edge and the shield, and log every purge.
Request the same object twice through an edge with any HTTP client and read the cache status header you expose from the upstream_cache_status variable: expect MISS, then HIT. Then check the Prometheus hit ratio per PoP over 24 hours. A healthy static workload should stay above 90% by bytes; below 80% points to cache-key fragmentation or undersized disks.
Plan rollback before launch. Keep DNS TTLs at 60 seconds during cutover and use weighted records so you can return traffic to the origin or a commercial CDN in one change. With anycast, withdraw the prefix from a misbehaving PoP rather than stopping the service, so BGP drains it cleanly. Size the origin to absorb full miss traffic for at least an hour.
Enforce HTTPS end to end, sign URLs for paid or private content, rate-limit per IP at the edge, and keep management ports off the public internet. Volumetric DDoS mitigation is the hard part: a self-built network is only as resilient as its transit capacity, so most teams keep a scrubbing service or a security-focused CDN in front of HTML and APIs. For monitoring, export per-PoP hit ratio, origin fetch rate, p95 time to first byte, 5xx rate and disk usage to Prometheus, chart them in Grafana, and alert on hit-ratio drops rather than CPU.
Creating your own CDN costs far more in people than in hardware. At 100 TB a month, this blog's 2026 estimate puts a minimal six-PoP build at roughly $11,000 to $14,000 a month, of which about $7,500 is half of one engineer at a $180,000 fully loaded annual cost. Hardware and bandwidth are the smaller line items.
Assumptions: 12 dedicated servers (six PoPs with N+1) at an estimated $250 to $500 each with bandwidth included; managed GeoDNS at $50 to $300; monitoring and logging at $100 to $500; 0.5 FTE at 100 TB and 1 FTE at 1,000 TB, which needs about 24 servers with 10 Gbps ports.
| Option | Monthly cost at 100 TB | Billing model | Monthly cost at 1,000 TB |
|---|---|---|---|
| BlazingCDN | $415 | Progressive per-TB tiers, no request fees | $3,315 |
| Amazon CloudFront (pay as you go) | $6,965 for transfer alone | Regional per-GB rates plus request fees | Not computed here |
| Self-built on dedicated servers (estimate) | $11,000 to $14,000 | Fixed servers plus staff | $23,000 to $29,000 |
| Self-built on hyperscaler VMs (estimate) | $13,000 to $18,000 | Per-GB egress plus compute plus staff | Egress-dominated, rarely viable |
At both volumes, the fixed engineering cost of a self-built CDN exceeds a metered CDN bill several times over, so cost alone almost never justifies building.
BlazingCDN publishes this blog, so verify the result on your own traffic; the 14-day testing period on real production traffic exists for exactly that. Commercial figures come from published price lists, checked August 2026.
As of October 2026, BlazingCDN charges from $5 per TB down to $2.50 per TB at volume on progressive tiers, with one rate for US, Europe and Asia and no request fees: 100 TB costs $415 and 1,000 TB costs $3,315 a month. Current rates are on the BlazingCDN CDN pricing page.
Honest limits apply. BlazingCDN does not support HTTP/3 or WebSockets and sells no WAF or DDoS mitigation, so it sits beside your security stack. Below about 46 TB a month, flat plans such as Amazon CloudFront Business ($200 for 50 TB) or Cloudflare Pro ($25 a month) can cost less.
Build a custom CDN when you need something nobody sells: delivery inside your own data centers for sovereignty, protocol behavior you must control, or edge logic tied to proprietary systems. Teams that already operate a network with peering and staff can reach favorable economics at multi-petabyte scale. Buy when the goal is lower cost or faster delivery of static files, video or downloads, because the per-TB market price is lower than the fixed cost of a team. Many organizations combine both, running their own nodes for core regions and a commercial CDN for overflow; for that pattern, see custom enterprise CDN infrastructure.
Usually not. A minimal self-built CDN at 100 TB a month costs an estimated $11,000 to $14,000 monthly in 2026, mostly engineering time, while metered CDNs charge a few hundred to a few thousand dollars for the same volume. Building wins on cost mainly at multi-petabyte scale for teams that already run networks and staff on-call rotations.
Deploy caching proxies such as Nginx or Varnish on servers in two or more regions, add an origin shield, and route users with GeoDNS health checks. Configure cache keys, TTLs, stale serving and request collapsing, then validate with cache status headers and hit-ratio metrics. A basic proof of concept takes one or two days; production hardening takes weeks.
Start with GeoDNS for a custom CDN because it needs no ASN or IP space and supports health-checked failover through a managed DNS provider. Move to anycast when you have your own ASN, a /24 prefix and transit partners, and need routing that ignores resolver location. Anycast requires careful BGP tuning to avoid catchment imbalance between PoPs.
Nginx is the most common choice to create your own CDN for static and large-file delivery, thanks to disk caching, stale serving and request collapsing. Varnish suits memory-heavy, policy-rich caching but needs a separate TLS terminator. Apache Traffic Server handles large cache hierarchies well. Pick the proxy your team can debug fastest under production pressure.
A self-built CDN needs at least two servers per PoP for N+1 redundancy, so six regions means twelve servers. At 100 TB a month, average throughput is about 309 Mbps with peaks two to three times higher, so 1 Gbps ports suffice per PoP. At 1,000 TB a month, plan for 10 Gbps ports and roughly double the server count.
Pull last month's egress from your origin or current CDN, compute the 95th percentile throughput per region, and count the engineering hours a CDN rotation would actually take, including on-call. Price the build with your real server quotes and loaded salaries, then compare it against a metered rate at the same volume. If the self-built total is not at least three times cheaper, the risk of operating it rarely pays off. To price the commercial side of that comparison, the BlazingCDN cost calculator computes your monthly volume on progressive tiers from $5 per TB.
Heavy traffic.
Light bill.
The CDN for video and large traffic
Learn
Verdict, evaluated November 2026: set max-age for the browser and s-maxage for the CDN, and keep them deliberately ...
Learn
Evaluated November 2026 against RFC 9111 and current vendor documentation. The short answer on no-cache vs no-store: ...
Learn
A CloudFront invalidation removes cached objects from every Amazon CloudFront cache layer before their TTL expires. As ...
Learn
A global CDN has to keep cached bytes within roughly 20 to 40 ms of round-trip time from users on every continent you ...