skip to content

A team switched its Cloudflare load balancer for api.example.com to DNS-only; failover now lags, sessions break, and some European users reach the US pool. Why, and what restores it?

level: seniorimportance: should knowfreq 26%

answer

  1. answers, not proxied requests
  2. resolvers keep cached answers
  3. no cookie without the proxy
  4. located by resolver or ECS
  5. orange cloud back on

basics

~20 s

A DNS-only load balancer only picks the endpoint address in a DNS answer. Resolvers cache it, so failover waits; without the proxy there is no affinity cookie; clients are located by resolver or ECS subnet. Proxying it again restores all three.

solid answer

~40 s

In DNS-only (gray-cloud) mode, Cloudflare answers DNS queries with a healthy endpoint's address and steps out of the request path. Failover lags because clients and resolvers keep using cached answers until they re-query. Sessions break because **session affinity** and **endpoint drain** need the proxy to set and read `__cflb`; DNS-only offers DNS persistence configurations instead. European users land in the US because location comes from the ECS subnet when present, otherwise from the recursive resolver, and a distant resolver looks like the wrong region; `location_strategy` (`prefer_ecs`, `mode`) adjusts that. The mode also exposes endpoint IPs, drops caching, the WAF and Workers, turns Least Outstanding Requests into plain weighted random, and raises billable DNS queries. Unless the hostname must be DNS-only, switch the proxy back on.

go deeper

for a junior

Recall that an orange-cloud load balancer proxies each request while a gray-cloud one only returns endpoint addresses in DNS answers.

for a middle

List what DNS-only loses: affinity, drain, WAF and caching, hidden IPs and meaningful Least Outstanding Requests, and why failover waits on caches.

for a senior

Diagnose each symptom from the mode, including resolver-based geolocation, location_strategy, and a gray CNAME bypassing a proxied load balancer.

for a principal

Set the rule that HTTP hostnames are load balanced proxied, with DNS-only reserved for MX, SRV and similar cases and a documented reason.

## What changes when the cloud turns gray A Cloudflare load balancer has two modes for HTTP hostnames: - **Proxied (orange cloud)**: layer 7 load balancing. Clients resolve the hostname to Cloudflare's addresses, and the Cloudflare data center serving each HTTP request picks a pool and an endpoint for that request. - **DNS-only (gray cloud)**: Cloudflare answers the DNS query with the address of a healthy endpoint, chosen by the same steering policies, and then is out of the path. The client connects straight to that endpoint. Everything the team noticed follows from Cloudflare no longer seeing the HTTP requests. ## Symptom 1: failover lags On a DNS-only load balancer, steering happens once per DNS answer. Cloudflare relies on resolvers honouring the load balancer's short TTL; a resolver or client that cached the old answer keeps sending traffic to the old endpoint, ignoring the load balancer until it re-queries. Proxied mode moves the decision to each request, so a pool marked Critical stops receiving traffic as soon as data centers act on the new status. The same caching delays planned work: disabling an endpoint or setting its weight to 0 on a DNS-only load balancer takes effect only as cached answers expire, so watch Load Balancing analytics until requests stop. ## Symptom 2: sessions break - **Session affinity is not supported in DNS-only mode.** The `__cflb` cookie is set and read by the proxy; with no proxy there is no cookie, so consecutive DNS answers can send one user to different endpoints. - **Endpoint drain is not supported** either, so planned maintenance cannot move sessions gradually. - The documented alternative is **DNS persistence**, with three recipes: Geo steering keyed on the Cloudflare data center that received the query (recommended), load shedding with IP hash, or custom rules splitting resolver IP space. Each keys on the resolver's query rather than on the user; the two IP-based recipes weaken when a resolver rotates its egress IPs, which is why the data-center recipe is preferred. ## Symptom 3: Europeans reach the US pool Proxied load balancing locates a client by the Cloudflare data center serving its request. DNS-only load balancing sees only the DNS query, so it locates the client by the **EDNS Client Subnet (ECS)** address when the resolver sends one, otherwise by the **recursive resolver**. A European user on a resolver that queries from the US looks American to Geo or Dynamic steering. The `location_strategy` object tunes this for DNS-only load balancers: | Field | Values | Effect | |---|---|---| | `prefer_ecs` | `always`, `never`, `proximity`, `geo` | whether the ECS location counts as authoritative (always, never, or only under that steering policy) | | `mode` | `pop`, `resolver_ip` | the fallback location when ECS is not used: the Cloudflare data center, or the resolver's geolocation | ## What else the gray cloud costs | | Proxied | DNS-only | |---|---|---| | Endpoint IP addresses | hidden behind Cloudflare | returned to every client | | Caching, WAF, Workers | available | bypassed | | Session affinity, endpoint drain | supported | not supported | | Least Outstanding Requests | uses in-flight request counts | counts treated as zero, so `random_steering` weights decide | | Authoritative DNS queries | fewer | more, which costs more with usage-based billing | | Private Network Load Balancing | supported | not supported | One more trap: a **DNS-only CNAME** pointing at a **proxied** load balancer hostname returns the endpoint IP, and HTTP requests to it are not proxied. Turning the load balancer orange is not enough if the record people actually use is gray. ## When DNS-only is the right choice, and how to restore the rest DNS-only is the right mode when there is no HTTP to proxy: a load balancer attached to an `MX` or `SRV` record (Enterprise) should be DNS-only. Other TCP or UDP services are balanced at layer 4 through Spectrum, which has no session affinity or caching either. For an HTTP API such as `api.example.com`, the fix is: 1. Set the load balancer back to **proxied** and check that no gray `CNAME` aliases point at it. 2. Re-enable **session affinity** and an **endpoint drain** duration. 3. Lock the origins so they accept traffic only through Cloudflare, since their addresses have been public. 4. If a business reason really forces DNS-only, set `location_strategy` to prefer ECS, use the DNS persistence recipe, and accept that failover depends on resolver caches.

  • Why does a DNS-only CNAME pointing at a proxied Cloudflare load balancer leak the endpoints?
    Proxy status is decided by the record clients resolve. A gray CNAME that targets a proxied load balancer returns the load balancer's endpoint address instead of Cloudflare's, and the client connects to it directly, so the request is not proxied. Make that alias proxied too, or remove it.
  • What does Least Outstanding Requests steering do on a DNS-only load balancer?
    It can be configured but works in a no-operation form. Cloudflare sees no requests, so every pool's outstanding request count is taken as zero and traffic is chosen by the random_steering weights alone. The docs advise against using it on DNS-only load balancers.

  • DNS-only failover is as fast as proxied because the TTL is short
  • The __cflb cookie still works if the endpoint sets it
  • DNS-only Geo steering always sees where the user really is
  • Making the load balancer proxied fixes every alias pointing at it
  • DNS-only mode keeps the endpoint addresses hidden