Skip to content

Geo-DNS routing: should you do it at the DNS layer, the LB, or the CDN?

Three different layers can route a user to the right region. Pick the wrong one and you inherit cache poisoning, multi-minute failovers, or a debugging nightmare.

Your SaaS goes multi-region. You have a customer in Sydney complaining about 380 ms TTFB on an app that runs out of Montreal, and the obvious answer is “send Australian users to an Australian replica.” Then you sit down to design it and discover there are at least three places where that decision could be made: the authoritative DNS, the load balancer in front of the regions, or a CDN that fronts everything. They are not interchangeable. The wrong choice quietly costs you minutes of recovery time during a regional outage and hours of debugging time when one region’s users get pinned to the wrong replica.

What’s happening

Geo-DNS at the DNS layer (Route 53, NS1, Cloudflare DNS with geo-steering, etc.) returns a different A/AAAA record based on the resolver’s apparent location. It’s stateless from the client’s view, the routing decision happens before the TCP handshake, and failover is bound to the TTL — drop the TTL too low and you hammer your DNS; leave it high and a regional outage takes 30 to 60 minutes to drain. The resolver location is also not the client location: a corporate user behind an 8.8.8.8 resolver in Frankfurt looks American.

Geo-routing at the load balancer layer (a global anycast LB like AWS Global Accelerator, Google Cloud Global LB, or a self-hosted HAProxy/Envoy fleet behind anycast) terminates the TCP/TLS connection at the closest point of presence and forwards to a regional backend over a private path. Failover is sub-second because the LB knows the backend is unhealthy; the trade-off is operational complexity (BGP, anycast, health-check propagation) and a price model that you absorb in egress and per-connection charges.

Geo-routing at the CDN layer (Cloudflare, Fastly, Akamai) takes it a step further: the CDN terminates TLS at the edge, serves static assets from cache, and proxies dynamic requests to the regionally closest origin. This is the right answer when your asset-to-API ratio is heavy on assets and the cache hit rate justifies the layer; it’s the wrong answer when you have to invalidate aggressively or your traffic is 95% authenticated API calls that no CDN will cache.

The decision is mostly about how fast you need failover, how cacheable your traffic is, and how much network plumbing you want to own.

How to verify

Test which layer is actually deciding the route for a client:

# 1. What does DNS resolution look like from different resolvers?
dig +short app.example.com @1.1.1.1
dig +short app.example.com @8.8.8.8
dig +short app.example.com @ns1.opendns.com

# 2. Where does the TCP connection actually land?
curl -s -o /dev/null -w "%{remote_ip} %{time_connect}\n" https://app.example.com/

# 3. Which region served the request? (Add a header to your origin)
curl -sI https://app.example.com/ | grep -i x-served-by

# 4. Cache hit rate at the CDN edge
curl -sI https://app.example.com/static/main.css | grep -iE 'cf-cache-status|x-cache'

Run these from at least three regions (use a probe service or a cheap VM in each region) before declaring victory. A geo policy that works for your laptop is not a geo policy.

The fix

A defensible decision tree we use on customer environments:

  1. Static-heavy, dynamic-light workload (marketing site, e-commerce catalog, content): CDN-layer geo + edge caching. DNS points everyone at the CDN; the CDN handles region selection for cache misses. Failover is a CDN concern and is generally sub-second.
  2. Latency-sensitive API with state per region (multi-tenant SaaS where each tenant lives in one region): LB-layer routing via anycast or a managed global LB. Keep DNS records short and stable; let the LB drain unhealthy regions. Failover is connection-level, not DNS-level.
  3. Multi-region read replicas, single-region writes: DNS-layer geo for reads (reads.example.com resolves by geo) and a single global anycast endpoint for writes. Keep the read TTL at 60 s, the write endpoint TTL at 300 s. Document the asymmetry in the runbook so the next operator doesn’t get clever and “fix” it.
  4. Compliance pinning (Canadian data must stay in Canada, EU data in EU): DNS-layer cannot enforce this — a misrouted resolver breaks compliance. Use LB-layer routing with an explicit deny-by-default policy and audit logs per region. DNS is a hint; the LB is the gate.

Whichever layer you pick, set TTLs sanely. A 60-second TTL is the floor for most resolvers — anything lower is mostly theatre, because large recursive resolvers cap your minimum. If your business requires sub-minute failover, you’re in LB-layer territory and DNS is no longer the right tool.


Stack Harbor designs and operates multi-region routing for B2B SaaS on managed cloud compute, including anycast LB fleets and CDN integration. If you’re scoping the right layer for your traffic shape, walk us through your architecture.