CONCEPT Cited by 1 source
Hairpin routing¶
Definition¶
Hairpin routing (in the CDN/caching context) is the pathological traffic pattern where a request is routed to a distant intermediary data center only to have that intermediary fetch content from an origin that was geographically close to the original requester — adding an unnecessary cross-continental round trip.
Canonical Example (Cloudflare)¶
Say your origin sits in Singapore, behind an anycast IP from a cloud provider. Because of how anycast works, our Chicago data center might show the lowest probe latency to that IP. Smart Tiered Cache would then select Chicago as the upper tier. The result: a request from an end user in Asia hits a nearby Cloudflare data center, gets routed cross-continent to the upper tier in Chicago, and Chicago fetches from the origin back in Singapore, crossing the ocean twice.
The path: Asia edge → Chicago upper tier → Singapore origin — when it should be: Asia edge → Singapore-adjacent upper tier → Singapore origin.
Root Cause¶
Hairpinning occurs when: 1. The topology selector relies on latency probes to an IP that doesn't represent the actual backend location. 2. Anycast/regional-unicast front-ends make many data centers appear equally "close" to the origin IP. 3. Without true location knowledge, a distant data center may win the latency race against the cloud provider's front-end.
Impact¶
- Adds hundreds of milliseconds of unnecessary latency.
- Wastes backbone bandwidth on redundant cross-continental hops.
- One of the most consistently reported issues from customers with cloud-hosted origins.
Mitigation¶
- concepts/anycast-origin-detection — detect when probing is unreliable and avoid pinning.
- patterns/region-hint-for-anycast-origins — explicit hint eliminates guessing.
- patterns/primary-fallback-pop-separation — ensures at least one tier is regionally appropriate.
Distinct From¶
Not to be confused with concepts/hairpin-route-leak (a BGP routing anomaly where a multi-homed AS re-advertises routes from one provider to another). The CDN concept here is about traffic inefficiency within a cache hierarchy, not inter-AS routing policy violations.
Seen in¶
- sources/2026-07-10-cloudflare-improving-smart-tiered-cache-for-public-cloud-regions — canonical description and the "Singapore via Chicago" example