Technology

Control CDN Bandwidth Costs: Caching, Origins and Regions

CDN invoices can grow even without a major traffic spike. Cache rules, origin configuration and regional traffic mix can contribute, but first separate origin transfer charges from CDN delivery charges and check for changes in payload size, request volume and rates. In this article, we will walk through concrete, engineering-focused techniques to keep CDN bandwidth costs under control while checking their effects on speed, reliability and content quality. We will focus on three main levers you can actually tune: how origin pull works and how often your CDN has to talk to your servers, how to improve cache hit ratio so fewer requests reach the origin, and how to evaluate regional pricing, routing and architecture choices against actual traffic paths and fees. The goal is simple: make your CDN work smarter, not harder, and make sure every gigabyte you pay for is delivering value.

Why CDN Bandwidth Costs Escalate So Quickly

Before we optimise anything, it helps to understand why CDN bills can grow faster than you expect. Many usage-based CDNs charge for data transfer out (egress), often with different prices per geographic region. Some also bill for HTTP requests or features like image optimisation or WAF; bundled plans may use a different billing model. Check which line items dominate your bill.

There are three common reasons costs grow faster than traffic:

  • Low cache hit ratio: Repeated cache misses increase origin transfers and may increase origin egress charges. Cache hits still incur CDN-to-user delivery charges where those are metered.
  • Chatty origin pull patterns: Even when content does not change, short TTLs, unnecessary cookies or query parameters can cause frequent revalidation or cache misses.
  • Regional traffic mix and origin placement: More delivery in higher-priced regions can raise the bill, while distant origins can add latency and, depending on the transfer tariff, cost. Changing origin location does not necessarily change the CDN’s delivery billing region.

If you are new to CDNs and want a refresher on the basics of how they work and why they are used, you can start with our overview explaining what a Content Delivery Network (CDN) is and its advantages for your website. In this article, we will go deeper into the cost side.

Understanding Origin Pull and Its Cost Implications

Most modern CDNs use an origin pull model. You keep your content on your own server (or object storage); when a user requests a resource and the CDN edge node does not have a usable cached response, the CDN fetches it from an upstream cache or your origin and delivers it to the user. If the response is cacheable, it can be stored for later requests with a matching cache key until it expires or is evicted, subject to any validation requirements.

What Exactly Happens on an Origin Pull?

For a single asset (say, /images/banner.jpg) the flow looks like this:

  1. User requests https://www.example.com/images/banner.jpg.
  2. The request reaches a CDN edge POP selected by the CDN’s routing, not necessarily the geographically nearest one.
  3. If the file is not in cache (a cache miss):
    • The CDN sends a request to your origin server.
    • Your origin responds with 200 OK, the file body and HTTP headers (especially Cache-Control, Expires, ETag, Last-Modified).
    • The CDN forwards the response to the user and stores it if the response and cache rules permit.
  4. On subsequent matching requests, if the cached response is fresh and does not require validation, the CDN can serve it without contacting the origin.

An origin fetch can incur egress charges from your origin server in addition to CDN egress charges to the user, depending on both providers’ tariffs and included allowances. CDN-to-user delivery may be billed even on cache hits. Revalidation of unchanged content can avoid retransferring the full body.

How Origin Behaviour Impacts Costs

Poorly configured cache headers or cache-unfriendly URL patterns mean more origin pulls than necessary. Examples:

  • Static assets like CSS, JS and images served with Cache-Control: no-cache or very short TTLs.
  • Asset URLs containing timestamps or random query strings that change even when the asset content has not changed, especially on every page view. Changing a version identifier when content changes is useful cache busting.
  • HTML pages that could be cached for a few seconds (microcaching) but are always treated as dynamic and unique.

Avoidable origin fetches consume bandwidth and can add latency; validation of unchanged content generally transfers much less data than a full fetch. Improving cache behaviour can reduce origin load and metered origin transfer costs. If you are already working on server-side performance, our article on fixing high TTFB on WordPress and PHP sites pairs well with CDN optimisation: a fast origin helps on misses, while effective caching reduces origin requests and transferred bytes.

Origin Shield and Tiered Caching

Many CDNs offer an origin shield or tiered caching feature. Instead of every edge POP talking directly to your origin, a small number of regional “shield” POPs sit in front of it. Edges fetch from the shield; the shield fetches from your origin only when it has to.

This has two benefits:

  • Fewer origin pulls: Edges sharing a shield can reuse the same cached asset rather than each fetching it from the origin. Multiple shields, cache variants, expiry and eviction can still require repeated origin fetches.
  • More centralised origin traffic: Concentrating fetches through shields can simplify monitoring and capacity planning, though origin demand still depends on misses and revalidation.

Origin shielding can be useful in image-heavy setups; compare any shield fees with the expected origin transfer and load savings. If you want a deeper dive into that, see our playbook on building an image optimisation pipeline with AVIF/WebP, origin shield and smarter cache keys.

Improving Cache Hit Ratio: A Key Origin Cost Lever

Request cache hit ratio (CHR) is the percentage of measured requests served from cache. A CHR of 95% means 5% were not counted as hits, not necessarily that exactly 5% reached your origin: reporting scope, revalidation and upstream cache tiers matter. Also measure byte hit ratio, the share of delivered bytes served from cache. Request CHR alone does not show origin bandwidth savings; a few large misses can outweigh many small hits.

Improving CHR can reduce origin bandwidth and processing costs, but does not by itself reduce CDN-to-user bytes for the same responses. Here is how to improve it systematically.

Step 1: Measure Current Cache Hit Ratio Correctly

Start with facts, not guesses:

  • Use your CDN dashboard or logs to measure overall request and byte hit ratios and, if possible, CHR by path or content type. Check whether bypassed requests and revalidations are included, and compare with actual origin request and byte totals.
  • Pay special attention to static assets (.css, .js, images, fonts) – CHR can be very high for popular, stable assets, but a 95%+ target is not universal: long-tail traffic, deployments and cache eviction affect it.
  • Look at top bandwidth-consuming URLs. Even a small number of uncached or poorly cached URLs can account for a large share of your bill.

CDN logs can complement application and origin measurements on a VPS. Use supported collectors with suitable Loki/Grafana or other tooling, and control retention and access to sensitive logs. The centralized VPS log management guide provides context. Promtail reached end of life on March 2, 2026; for a current deployment or migration, use Grafana Alloy or another supported client.

Step 2: Fix Cache Headers for Static Assets

Static assets are the easy win. For public static files, use long-lived caching combined with asset versioning (fingerprinting) in the filename. Assign a new URL whenever the content changes; never overwrite a file at an existing versioned URL.

Recommended pattern:

  • File named like app.5fd3b2.css or main.2025-12-03.js.
  • Served with headers such as:
    Cache-Control: public, max-age=31536000, immutable

This tells the CDN (and browsers) that as long as the URL is the same, the content will not change for a year. When you deploy a new version, you change the filename, not the content at the old URL.

For Nginx, the following example is suitable only in a server dedicated to public, versioned static assets. It matches extensions, not fingerprints; do not apply it unchanged to a mixed-content site or assets whose URLs are reused. With standard Nginx inheritance, defining add_header here stops parent-level add_header directives from being inherited, so retain any required headers explicitly and check the effective response headers.

location ~* \.(css|js|png|jpe?g|gif|webp|avif|svg|ico)$ {
    add_header Cache-Control "public, max-age=31536000, immutable";
}

Make sure your CDN honours the intended origin cache policy. Use explicit edge TTL overrides only for known cacheable content, without overriding privacy restrictions or caching personalised responses as public.

Step 3: Use Smart HTML Caching and Microcaching

HTML is trickier because it often contains personalised or rapidly changing content. For public responses that are identical for all requests sharing a cache key, short-lived caching or microcaching at the CDN or origin can help. A short TTL alone does not make shared caching safe for personalised content; bypass shared caching for it unless isolation is explicitly designed and verified.

Techniques that work well in practice:

  • Cache public, anonymous pages: Category pages, blog posts, landing pages and documentation are candidates for shared caching only when their responses contain no user-specific data. For example, consider 30–300 seconds if that staleness is acceptable; bypass shared caching for personalised or authenticated responses.
  • Avoid unnecessary cookies on public pages: If an application sets a session cookie for every visitor, cookie-related cache rules may cause bypasses or extra variants. Check the CDN’s actual policy rather than assuming every cookie makes a request unique.
  • Combine origin microcaching with CDN caching: For responses safe to share, use Nginx FastCGI cache or reverse-proxy cache at origin for 1–5 seconds; allow a longer CDN lifetime only within the content’s freshness budget, with personalisation bypasses at both layers. We explore this pattern in detail in our article about Nginx microcaching to make PHP applications feel instantly faster.

For dynamic e-commerce flows (carts, checkout, account pages) you should bypass full-page caching, but you can still cache static assets and public, read-only AJAX API responses using lifetimes appropriate to their update frequency. Do not cache cart mutations, personalised responses or rapidly changing checkout data merely because they use AJAX.

Step 4: Normalise Cache Keys and Reduce Variants

Each CDN object is identified by a cache key. By default, that might include some combination of host, path, query string, headers and cookies. If your query strings or cookies vary wildly, the CDN can end up storing many copies of essentially the same response.

To reduce variants and improve CHR:

  • Ignore tracking parameters (e.g. utm_source, fbclid) in the cache key only after confirming that they do not change the response.
  • Allowlist query parameters that change a public response (e.g. page=, lang=, size=). Bypass shared caching for authentication or private variants; do not simply omit those parameters from the key.
  • Strip or ignore only cookies confirmed not to affect public responses; preserve application-required cookies and bypass shared caching for session, cart or other personalised content.
  • Use a predictable pattern for language and device variants (subdirectories, subdomains, or clearly named query parameters).

Most CDNs let you define precise cache key rules at the edge. Doing this well can improve CHR by consolidating equivalent responses. The gain depends on existing variants and traffic; reduced origin transfer does not necessarily reduce billed CDN-to-user bandwidth.

Step 5: Leverage Stale Content and Revalidation Smartly

Revalidation can return 304 Not Modified when the stored response is unchanged, avoiding a response body, but it still uses bandwidth and origin capacity. Rather than expiring objects too aggressively, consider using:

  • stale-while-revalidate: Where supported, allow a stale cached response during a bounded window while the cache revalidates it in the background.
  • stale-if-error: Where supported and permitted by the cache policy, allow stale content within a configured window for qualifying errors, potentially improving resilience and reducing failover traffic.

We discuss these directives and their real-world behaviour for WordPress and Nginx in our article on how stale-while-revalidate and stale-if-error make caching feel effortless. From a cost perspective, serving stale content can reduce some origin or failover work, but it trades freshness for availability and latency. Choose stale-serving windows that the content can tolerate; background revalidation still contacts the origin.

Designing Your Origin for Efficient CDN Use

Origin configuration affects cacheability, fetch size and the work needed to answer misses. This section covers both transfer-cost controls and ways to protect application capacity; faster response generation alone does not reduce the number of bytes delivered by the CDN.

Serve Compressed Content by Default

For compressible assets, enable origin compression where the CDN’s origin requests support it:

  • Gzip for HTML, JSON, XML, JS and CSS.
  • Brotli where supported (often offers better compression ratios for text).

Many CDNs preserve origin compression, while others can re-compress at the edge. Minimise origin response size using an encoding accepted by the CDN; compression saves origin egress only when the origin-to-CDN transfer is compressed. Edge bandwidth savings depend on what is delivered to users and how it is billed.

Compression also requires safe cache handling of negotiated representations. Send Vary: Accept-Encoding or verify equivalent CDN encoding handling that prevents reuse of an incompatible representation. The Content-Encoding header must match the response body, including after edge transformation; do not label an uncompressed body as Gzip or Brotli. Check origin and edge responses, including cache hits, for requests accepting different encodings and for requests requiring an uncompressed response.

For Nginx Gzip and the ngx_brotli filter or negotiated static handler, enable gzip_vary on; in the applicable configuration: it defaults to off and controls insertion of the Vary header through Nginx’s compression machinery. For precompressed Brotli files, use brotli_static on;, not the unconditional always mode, when client negotiation is required. These configuration prerequisites do not replace checking the CDN’s effective encoding and cache behaviour.

Avoid Unnecessary Redirect Chains

Each redirect means:

  • An extra request from user to CDN.
  • An extra request from CDN to origin if the redirect requires an origin fetch rather than being cached or generated at the edge.

Common mistakes include:

  • http:// → https:// → www. redirect chains instead of a single direct redirect.
  • Continuing to link internally to /index.php or /home when those URLs redirect to the canonical /.

Where security requirements allow, consolidate canonical redirects and link directly to final URLs. This reduces unnecessary requests; the bandwidth savings depend on redirect volume and response size.

Consider Separate Static and Dynamic Domains

A separate hostname such as static.example.com or cdn.example.com can simplify static-file policies, though separation alone does not guarantee lower costs and can add connection overhead:

  • CDN configuration can be tuned for that hostname (long TTLs for versioned public assets and appropriate cache keys). Keep it cookie-free through cookie scoping; a subdomain alone does not prevent parent-domain cookies from being sent.
  • Dynamic HTML and API endpoints can have more conservative caching and security rules.

This separation also simplifies debugging and helps you analyse cache hit ratios and bandwidth for static vs dynamic content independently.

Use Origin-Level Caching to Protect the Application

Even with a CDN, a sudden cache miss wave (after a deploy, purge, or regional failover) can hammer your origin if it has to regenerate every response from the application layer.

To reduce this load, use:

  • Reverse-proxy caching at origin (e.g. Nginx FastCGI cache or Varnish) to shield your app servers.
  • Database and object caching (Redis, Memcached) to reduce per-request processing cost.

We have a detailed article on server-side optimisations for WordPress using PHP-FPM, OPcache, Redis and MySQL tuning. The same principles apply: the more efficiently your origin can answer a single request, the less painful it is when the CDN does need to pull from it.

Regional Pricing and Traffic Steering Strategies

Some CDNs use regional pricing tiers for bandwidth; others offer flat-rate or bundled plans. Traffic delivered in North America or Western Europe might be significantly cheaper than traffic in some Asia-Pacific, Latin American or Middle Eastern regions. Optimising for this reality is about smart architecture, not about blocking users.

Know Your Regional Traffic and Cost Profile

First, you need visibility:

  • From your CDN reports, extract bandwidth by region or POP.
  • Compare that to your CDN’s price per GB per region.
  • Identify high-cost regions where you have significant volume.

Then, map that to your business priorities. If 5% of your revenue comes from a region consuming 30% of your expensive bandwidth, you might rethink how aggressively you serve heavy assets there.

Place Origins Strategically

Your origin’s location affects origin-fetch latency and may affect origin egress charges. Do not assume that moving the origin changes which CDN delivery regions are billed. Compare the CDN’s actual origin-fetch paths, including any shield, and the hosting and CDN tariffs before predicting savings.

Our article on how server location affects SEO and speed provides additional context. When considering DCHost, verify the chosen product’s available locations and egress terms. If colocation is required, confirm that it is offered and obtain its specific scope; a VPS offering does not establish that service. A geographically shorter path is not necessarily cheaper.

Use Geo and Weighted DNS for Multi-Region Architectures

If your audience is global and you operate multiple origins, consider geo DNS or weighted routing where compatible with your CDN’s origin selection. Geo DNS for an origin hostname must not be assumed to locate the end user: the DNS lookup may reflect a CDN resolver or shield location. Weighted routing distributes traffic by configured proportions, not inherently by geography. Confirm the CDN’s supported regional origin-routing behaviour before relying on either approach.

Regional origin routing may reduce origin-fetch latency or egress costs, but does not by itself establish lower CDN-to-user regional charges. Include replication and additional hosting costs when comparing architectures. We describe these patterns in detail in our guide on geo and weighted DNS routing across regions.

Right-Size Content for High-Cost Regions

Sometimes, the most pragmatic approach is to serve lighter content in regions where bandwidth is particularly expensive, especially for non-critical assets:

  • Offer more compressed or lower-resolution image variants where measured delivery costs justify the quality trade-off; physical distance alone does not establish a higher bandwidth rate.
  • Lazy-load non-essential scripts and assets, or disable selected background videos and heavy animations where the product requirements allow.
  • Cache API responses more aggressively only where shared reuse is safe and freshness, legal and business constraints allow. This targets origin work and transfers, not the CDN delivery bytes for unchanged responses.
  • If responses vary by region, use distinct asset URLs or a verified cache-key dimension so one region’s variant is not inadvertently served to another.

These optimisations can make the site faster as well as cheaper, but lower-resolution media and disabled features can reduce quality or functionality. Your frontend and product teams should be involved, but the infrastructure side can provide the data and tools.

Plan for Traffic Spikes and Campaigns

Campaigns that target specific countries can suddenly push a lot of traffic into one region. Before a big launch, make a habit of:

  • Estimating expected visitors and bandwidth per region.
  • Ensuring your CDN caching rules and origin capacity are tuned for that pattern.
  • Setting campaign-specific cache lifetimes only for public assets within their freshness budget, while preserving personalisation bypasses and safe compression negotiation.

Our checklist on scaling hosting for traffic spikes and big campaigns is a useful companion to this step, especially when combining CDN optimisation with backend scaling.

A Practical CDN Bandwidth Cost Control Checklist

To make all of this actionable, here is a condensed checklist you can work through over a week or two. Measure savings against your baseline; the benefit depends on your starting configuration, traffic mix and billing model.

Day 1–2: Measure and Baseline

  • Collect CDN and origin invoices; separate delivery, origin transfer, request and feature charges, including allowances and regional rates.
  • Export CDN analytics: request and byte hit ratios, CHR by type (HTML, CSS/JS, images, API), and top bandwidth URLs. Check reporting scope and compare with actual origin requests and transferred bytes.
  • Identify your main origin(s), their locations and any shield paths. Record traffic volume and payload sizes so later cost comparisons account for changes in usage.

Day 3–4: Fix the Obvious Cache Issues

  • Set long-lived Cache-Control with immutable for versioned static assets.
  • Ensure images use modern formats (WebP/AVIF where possible) and appropriate sizes, retaining suitable fallbacks for unsupported clients. If one URL selects the format using Accept, send Vary: Accept on all relevant responses, including JPEG/PNG fallbacks, preserve existing Vary dimensions and verify the CDN cache key. Distinct fixed-format URLs do not require this format negotiation.
  • Review HTML caching rules: enable microcaching or short TTL where safe.
  • Strip tracking parameters and non-essential cookies from CDN cache keys only after confirming that they do not affect response content or access permissions.

Day 5–6: Tuning Origin and Compression

  • Enable Gzip/Brotli for text assets where the CDN’s origin requests support them. Require correct Content-Encoding and Vary: Accept-Encoding headers or verified equivalent CDN encoding handling; for the Nginx Gzip/ngx_brotli configurations described above, enable gzip_vary on. Check negotiated responses on both cache misses and hits.
  • Where security requirements allow, simplify redirect chains and link directly to final URLs.
  • Implement origin caching (e.g. Nginx FastCGI cache) for dynamic pages that are safe to share, with bypass rules for authenticated or personalised responses.
  • Verify that your CDN is respecting and using origin cache headers correctly.

Day 7–10: Regional and Architectural Improvements

  • Review bandwidth by billed region against actual rates and allowances; flag expensive regions with high usage.
  • Evaluate moving or adding origins using VPS or dedicated servers against actual CDN fetch paths, including shields. Compare latency, egress, hosting and replication costs; moving an origin does not necessarily change delivery billing regions.
  • Evaluate origin shield/tiered caching where available, comparing feature fees with expected origin transfer and load savings.
  • For multi-region origins, confirm CDN-compatible origin routing before planning geo/weighted DNS. Geo DNS may locate a CDN resolver or shield rather than the user; weighted DNS distributes by proportions, not inherently by geography.

Ongoing: Monitoring and Budget Control

  • Set alerts on CDN spend and bandwidth, origin transfer, and request or byte hit-ratio drops. Choose thresholds from the baseline for each content class rather than applying a universal static-asset CHR target.
  • After each deployment, verify cache headers, cache keys, personalisation bypasses and negotiated compression on misses and hits.
  • Periodically review top bandwidth URLs and adjust caching or media optimisation accordingly; compare costs at similar traffic volumes and check latency, freshness and content quality.

Where Your Hosting Provider Fits In

A CDN does not replace good hosting; it amplifies it. The origin servers behind your CDN still need to be:

  • Fast enough to handle cache misses and revalidation without slowing down.
  • Reliable enough to minimise outages, even when stale-if-error and other resilience patterns are available.
  • Flexible enough to scale or move closer to your audience as your traffic and regional balance change.

For an origin architecture using VPS, dedicated or colocation servers, evaluate server sizing and regional placement alongside CDN tuning. Ask prospective hosting providers about available locations, transfer allowances, overage rates and the support scope for your chosen CDN. Confirm responsibilities for cache configuration, origin security and troubleshooting rather than assuming architecture assistance is included.

If you are planning a new project or re-architecting an existing one, you can combine the ideas from this article with our resources on cutting hosting costs by right-sizing VPS, bandwidth and storage to build a solution that is both performant and predictable in cost.

Conclusion: Make Every Gigabyte Work for You

CDN bandwidth costs become easier to manage when you separate origin transfers from CDN delivery and measure both against actual traffic and tariffs. Cache public static assets aggressively with proper versioning, use microcaching for HTML that is safe to share, and reduce unnecessary cache variants to limit origin work. Use correctly negotiated compression and appropriately sized media to reduce transferred bytes, checking content quality and cache behaviour along the way. Evaluate origin placement, shielding and geo/weighted routing against actual fetch paths and provider fees rather than assuming they remove expensive delivery regions. Compare the resulting costs, latency and freshness with your baseline before treating a change as a saving.

Whether you use shared hosting or run workloads on VPS, dedicated servers or colocation, take your CDN reports, origin transfer figures and freshness requirements to your hosting provider when reviewing the design. If you are considering DCHost, confirm available infrastructure, egress terms and the scope of any configuration assistance before committing. The aim is a stack whose performance and cost are understood and monitored, with avoidable waste reduced rather than savings assumed.

Frequently Asked Questions

Request cache hit ratio is the percentage of measured requests counted as cache hits. Non-hits do not necessarily all reach the origin: revalidation, reporting scope and upstream cache tiers matter. Also measure byte hit ratio and actual origin transfers, because a few large misses can dominate bandwidth. Better caching can reduce origin costs, but does not itself reduce CDN-to-user bytes for the same responses. A 90–95% target is not universal.

Identify your largest bandwidth-consuming URLs and separate origin transfer charges from CDN delivery charges. Use long-lived caching for public, versioned assets and optimise image formats and sizes. Enable compression with correct Content-Encoding and Vary: Accept-Encoding headers or verified equivalent CDN encoding handling. Ignore parameters or cookies in cache keys only when they do not affect content or access permissions. Caching mainly reduces origin transfers; smaller delivered responses can reduce metered CDN bandwidth.

Consider it when multiple edge locations repeatedly fetch the same assets and origin bandwidth or processing is costly. Edges sharing a shield can reuse cached responses, reducing origin pulls. Multiple shields, variants, expiry and eviction can still cause repeated fetches, so it is not a single-fetch guarantee. Compare shield fees with expected origin transfer and load savings using your actual traffic paths.

No. Total cost depends on origin and CDN tariffs, included allowances, request charges, payload sizes and regional traffic. Cache misses can incur both origin transfer and CDN delivery charges, while cache hits may still incur CDN delivery charges. Effective caching, compression and suitable architecture can help, but savings should be measured against a baseline rather than assumed.

Origin location affects fetch latency and may affect origin egress charges, but moving it does not necessarily change the CDN delivery regions billed. Compare actual fetch paths, including shields, and both providers' tariffs. Multi-region origins add hosting and replication costs. Geo DNS may reflect a CDN resolver or shield rather than the user, and weighted DNS distributes traffic by proportions rather than inherently by geography.
↑