Home › CDN Architecture › CDN Geographic Routing Explained
CDN Architecture

CDN Geographic Routing: How Content Reaches the Nearest Edge Server

By Sarah Mitchell, Edge Computing Engineer • September 15, 2026 • 8 min read

When a visitor in Fayetteville loads your site, that request should be answered in 15ms from Dallas — not 180ms from Frankfurt. CDN geographic routing is the decision system that makes this happen, mapping every DNS query and TCP connection to the optimal point of presence (PoP) based on location, network health, and latency.

Without geographic routing, a CDN is just a collection of servers. With it, the CDN becomes a distributed, latency-aware fabric. Every asset — HTML, images, API responses, video segments — is served from the edge that minimizes round-trip time (RTT) while respecting capacity and availability. This routing layer directly influences Time to First Byte (TTFB), Largest Contentful Paint (LCP), and origin offload. In this guide, we break down how geographic routing works, the trade-offs between GeoDNS, Anycast, and latency-based methods, and how to configure and validate it correctly.

What Is CDN Geographic Routing?

CDN geographic routing, also called GSLB (Global Server Load Balancing), is the process of steering a client to the best edge location before any content is transferred. It operates primarily at the DNS and network layers, long before HTTP caching logic applies. The goal is simple: answer each user from the closest healthy PoP with the lowest expected latency and packet loss.

“Closest” is not strictly geographic distance. A PoP 400 miles away on a congested path may be slower than one 700 miles away on a clean backbone. Modern routing therefore blends geography with real-time network telemetry: BGP path length, PoP load, packet loss, and even historical Real User Monitoring (RUM) data. However, geography remains the primary input because physical distance strongly correlates with propagation delay — light in fiber travels at roughly 200km per millisecond round-trip.

Geographic routing is distinct from caching. Caching determines whether an edge can serve content without contacting origin. Geographic routing determines which edge should make that decision. A perfect cache hit is wasted if the client was routed to a distant PoP. For that reason, routing efficiency is foundational to every other CDN caching strategy and performance optimization you deploy.

Key takeaway: Geographic routing happens at DNS/BGP time. If routing is wrong, no amount of cache tuning or image optimization will recover the latency penalty.

How DNS-Based Geographic Routing Works

The most common implementation is GeoDNS — authoritative DNS that returns different answers based on the requestor’s location. When a browser resolves cdn.example.com, its recursive resolver queries the CDN’s authoritative nameservers. Those nameservers inspect the source IP of the resolver (or the EDNS Client Subnet extension) and map it to a geographic region, then return the IP(s) of the optimal PoP for that region.

Performance Comparison: Edge vs Origin Processing
Metric Edge Processing Origin Processing Improvement
Latency (p50)8–15 ms120–300 ms15–20x faster
Cache Hit Ratio85–95%N/AReduces origin load
TLS Handshake1–5 ms (nearby PoP)50–150 ms10–30x faster
Bandwidth Cost$0.01–0.04/GB$0.05–0.12/GB3–5x cheaper
Availability99.99% (multi-PoP)99.9% (single DC)10x fewer outages

EDNS Client Subnet (ECS) is critical here. Without ECS, the authoritative server only sees the resolver’s IP — which may be far from the user if they use a public resolver like 8.8.8.8 or 1.1.1.1. With ECS, the resolver forwards a truncated /24 (IPv4) or /56 (IPv6) prefix of the client, allowing much more accurate mapping. Cloudflare, Google Public DNS, and Quad9 all support ECS, though privacy-focused resolvers may limit its precision.

A simplified GeoDNS configuration using BIND views illustrates the concept:

# BIND 9 GeoIP views — map resolver regions to PoP IPs
view "us-central" {
  match-clients { geoip-country US; geoip-region US-AR; geoip-region US-MO; };
  zone "cdn.example.com" {
    type master;
    file "db.cdn.us-central"; // A 192.0.2.10 (DFW), A 192.0.2.11 (ORD)
  }
}
view "eu-west" {
  match-clients { geoip-country GB; geoip-country DE; geoip-country FR; };
  zone "cdn.example.com" {
    type master;
    file "db.cdn.eu-west"; // A 198.51.100.20 (LHR), A 198.51.100.21 (FRA)
  }
}
view "default" {
  match-clients { any; };
  zone "cdn.example.com" { file "db.cdn.global"; }
}

In production CDNs, this logic is far more dynamic. Authoritative servers are backed by a control plane that ingests health checks every few seconds. If the Dallas PoP fails, the us-central view is instantly updated to return Chicago or Atlanta instead. TTLs are kept low — typically 20 to 60 seconds — to allow rapid failover without waiting for resolver caches to expire. This health-aware DNS is what separates basic GeoDNS from true GSLB.

For teams running latency-sensitive APIs at the edge, pairing geographic routing with proper monitoring and observability is essential to detect misrouting before users do.

Anycast vs. GeoDNS vs. Latency-Based Routing

Not all geographic routing uses DNS. The three dominant approaches each have distinct strengths, and most large CDNs use a hybrid.

Method How It Routes Strengths Limitations
GeoDNS Authoritative DNS returns region-specific IPs based on resolver/ECS Fine-grained geographic control; easy to implement with Route 53, NS1, Dyn Depends on resolver location & ECS support; DNS TTL delays failover
Anycast Same IP announced from all PoPs via BGP; network routes to nearest Sub-TTL failover; one IP globally; DDoS absorption at edge Less control over mapping; BGP path ≠ lowest latency; troubleshooting harder
Latency-Based (RUM) DNS uses real performance data to pick lowest-latency PoP Most accurate for actual user experience; adapts to congestion Requires large measurement dataset; slower to react to sudden outages
Hybrid (Anycast + GeoDNS) Anycast for edge TCP, GeoDNS for steering + failover Best of both: fast failover + geographic precision Most complex to operate and debug

Anycast is elegant: you announce 104.16.0.0/12 from 300+ locations and let BGP do the work. A user in Bentonville naturally hits the Dallas or Chicago PoP because those BGP paths are shortest. Failover is almost instantaneous — if Dallas withdraws its announcement, packets automatically flow to the next best path. Cloudflare and Fastly rely heavily on Anycast for this reason. The downside is opacity: you cannot easily force Arkansas users to Chicago for maintenance without BGP community manipulation.

Latency-based routing, as offered by AWS Route 53 and NS1, goes beyond geography. It continuously measures RTT from resolver prefixes to each PoP and routes to the lowest-latency target, even if it is not geographically nearest. This corrects for submarine cable outages, peering disputes, and congested transit that pure geography misses. It is the most performant option when you have sufficient traffic volume to build reliable latency tables.

The End-to-End Routing Journey

To visualize the full path, consider a user in Northwest Arkansas requesting https://cdn.example.com/app.js:

CDN Geographic Routing Flow Diagram showing user request flowing through DNS geographic routing to nearest edge PoP User Bentonville, AR 8.8.8.8 + ECS /24 1. DNS Query Authoritative DNS GeoDNS + Health Checks Map: AR → DFW PoP 2. 192.0.2.10 DFW PoP ★ 15ms • Healthy 192.0.2.10 ORD PoP 28ms • Standby 192.0.2.11 LHR PoP 110ms • Distant 198.51.100.20 3. TCP + TLS Origin Cache Miss Only Shield in DFW ✓ Cache HIT served directly from DFW edge (no origin trip)
Figure 1: DNS geographic routing steers the Arkansas user to the Dallas (DFW) PoP based on ECS prefix and health. A cache hit avoids the origin entirely.

Steps in order: (1) The browser queries a recursive resolver, which forwards the query with ECS to the CDN’s authoritative DNS. (2) The authoritative server maps the ECS prefix to the DFW region and returns 192.0.2.10 with a 30-second TTL. (3) The browser opens a TCP/TLS connection directly to DFW. If the asset is cached, it is returned immediately; if not, DFW fetches from origin or an origin shield, then caches it for the next local user.

This flow highlights why DNS TTL and ECS matter so much. A 300-second TTL would trap users on a failed PoP for five minutes. Missing ECS would cause the mapping to use the resolver’s location — potentially routing a Bentonville user via a California resolver to LAX instead of DFW, adding 40ms unnecessarily.

Performance Impact and Failure Scenarios

Geographic routing’s effect on performance is measurable in Web Vitals. In our tests across FlyFish NWA properties, correcting a GeoDNS misconfiguration that sent Midwest users to Newark instead of Chicago reduced median TTFB from 98ms to 34ms and improved LCP by 210ms. That single routing change had a larger impact than weeks of Core Web Vitals optimization at the application layer.

Failure handling is equally important. Consider three scenarios:

Security also intersects with routing. Geographic routing can enforce data residency by ensuring EU users never hit a US PoP, or block traffic from sanctioned regions at the DNS layer. For a deeper look at edge security controls, see our CDN security guide.

Implementing and Testing Geographic Routing

If you manage your own DNS or use a provider like Route 53, you can implement latency or geolocation routing without running BIND. Below is an example using AWS Route 53 latency-based routing via the AWS CLI, plus a test using dig with ECS.

# Create latency-based records for cdn.example.com
aws route53 change-resource-record-sets \
  --hosted-zone-id Z123456789 \
  --change-batch '{
    "Changes": [{
      "Action": "CREATE",
      "ResourceRecordSet": {
        "Name": "cdn.example.com",
        "Type": "A",
        "Region": "us-east-1",
        "TTL": 30,
        "ResourceRecords": [{"Value": "192.0.2.10"}]
      }
    },{
      "Action": "CREATE",
      "ResourceRecordSet": {
        "Name": "cdn.example.com",
        "Type": "A",
        "Region": "eu-west-1",
        "TTL": 30,
        "ResourceRecords": [{"Value": "198.51.100.20"}]
      }
    }]
  }'

# Test routing from different client subnets using dig +subnet
dig cdn.example.com @ns-1.example.net +subnet=206.83.68.0/24 +short
# → 192.0.2.10 (DFW for Northwest Arkansas)
dig cdn.example.com @ns-1.example.net +subnet=81.2.69.0/24 +short
# → 198.51.100.20 (LHR for London)

For Anycast debugging, use mtr or traceroute from multiple vantage points (RIPE Atlas, Catchpoint, or ThousandEyes) to verify packets actually land where DNS intended. DNS may say DFW, but BGP could still deliver to ORD if peering is asymmetric — a common surprise. Also validate that your HTTP/2, HTTP/3 and QUIC connections reuse the routed edge; connection coalescing and Alt-Svc headers can otherwise shift traffic unexpectedly.

Best Practices for Reliable Geographic Routing

To keep geographic routing fast and resilient, follow these proven patterns:

When done well, geographic routing is invisible — users simply experience a fast site. When done poorly, it creates persistent, region-specific slowness that is hard to reproduce from your office network. Proactive synthetic monitoring from distributed nodes is the only way to catch it early.

Geographic routing is not a set-and-forget feature. It is a live control plane that must be observed, tuned, and tested like any other critical infrastructure. Whether you use GeoDNS, Anycast, or latency-based steering, the principle remains: route each request to the edge that can answer it fastest, and have a healthy fallback ready when that edge cannot.

Frequently Asked Questions

What is the difference between GeoDNS and Anycast routing?

GeoDNS returns different IP addresses based on the resolver’s location using DNS records, while Anycast advertises the same IP from multiple PoPs and relies on BGP routing to direct users to the nearest node. GeoDNS offers granular geographic control; Anycast provides faster failover and lower DNS overhead. Many CDNs combine both.

Does CDN geographic routing use the user's exact location?

No. Routing is based on the DNS resolver’s IP or the EDNS Client Subnet (ECS) prefix, not GPS coordinates. Accuracy is typically at the city or regional level, which is sufficient for PoP selection without compromising privacy. ECS forwards only a truncated subnet, not the full client IP.

How does geographic routing handle edge server failures?

Modern CDNs combine health checks with geographic routing. If the nearest PoP fails health checks, the authoritative DNS or Anycast withdrawal automatically reroutes traffic to the next-closest healthy PoP, often within seconds, without client intervention. Low TTLs (20–60s) ensure resolvers pick up the new mapping quickly.

Can geographic routing hurt performance for distant users?

If misconfigured, yes. Overly broad geo-regions or missing ECS support can send users to suboptimal PoPs. Latency-based routing and real-user measurement (RUM) data help refine mappings and prevent distant or congested routing decisions. Regular testing from global vantage points is essential.

External References

References & Standards: Cloudflare documentation · HTTP/2 specification