Skip to content
INTERNET INFRASTRUCTURE & NETWORKS

Cloudflare Launches "Origin Range Requests" to Overhaul Large File Caching and Reduce Global Bandwidth Waste

Cloudflare has announced the general availability of Origin Range Requests, a newly engineered caching feature designed to drastically optimize how Content

Delivery Networks handle partial file downloads. Available immediately as a self-service feature across all Cloudflare plans, the new architecture promises to eliminate years of network inefficiencies associated with serving large media files, software packages, and interrupted downloads. By fundamentally changing how its edge network processes HTTP range requests, the company aims to reduce unnecessary origin data transfers, ease disk operations, and improve global content delivery speeds.

The engineering overhaul addresses a long-standing challenge in running a CDN at scale: managing requests for fractions of large files. HTTP range requests are a foundational mechanism of the modern internet. When a video player skips to the middle of a movie, a download manager resumes a dropped connection, or a package manager fetches a specific piece of an artifact, the client sends a standard HTTP GET request equipped with a Range header. The server responds with 206 Partial Content, pinpointing the exact byte boundaries requested.

While the client’s objective is simple, satisfying these requests efficiently at a global scale has historically forced severe compromises on CDN infrastructure. Under Cloudflare’s legacy range-caching implementation—which mirrored the cache-slicing mechanics utilized by traditional proxy architectures like NGINX—each client request was mapped to fixed-size chunks of a file, with range sizes and file extensions configured statically per zone.

This rigid design created an unforgiving operational dilemma. Setting a small range size meant that a single user action could trigger a cascade of dozens of small origin requests, placing heavy memory pressure on Cloudflare’s servers as they attempted to coalesce the fragments in-memory. Conversely, configuring a large range size meant the network would download vastly more data than the client actually requested. For instance, a video viewer seeking to the middle of a movie might prompt the old system to pull 128 megabytes from the origin server and shuttle it across multiple data centers—sometimes long after the viewer had already abandoned the stream and closed the browser tab.

Furthermore, these legacy limitations rippled outward. Updates to the configured range size would automatically invalidate existing cache entries because the size was baked directly into the cache key. Concurrent requests falling anywhere within the same range would mutually block one another, regardless of how far apart the specific clients’ requested bytes were. Most critically, the legacy NGINX-based cache could not combine range caching with concurrent streaming, a feature built to let multiple clients read a file from the cache while it was still actively being written. Turning both features on simultaneously forced responses to be cut short, requiring popular files to undergo a separate origin fetch for every single range. These internal bottlenecks meant that customers frequently bore the brunt of these architectural constraints without possessing deep insight into the network’s underlying capabilities.

The turning point arrived as Cloudflare transitioned its edge infrastructure from NGINX to Pingora, its custom-built, memory-safe proxy connecting the network to the internet. Because Pingora was already engineered to store every cached file on disk in fixed-size chunks to seamlessly support interrupted downloads, the engineering team realized that the system’s range size no longer needed to be a static configuration setting. Instead, the range size could simply align with the natural chunk size of the cache itself.

Origin Range Requests: Serving large files without range-request tuning

Under the new Origin Range Requests architecture, when a client requests a specific byte range, Cloudflare’s edge checks which of those bytes are already present in the local cache and serves them immediately. For any missing data, the network fetches origin ranges that are strictly aligned to the fixed-size chunk boundaries of the cache. It stores the resulting data in the exact same chunks used for ordinary storage, but ultimately returns precisely and only the specific bytes requested by the client downstream.

While this does not completely eliminate extra work for requests smaller than the established chunk size—which may still necessitate fetching an entire containing chunk—the difference is that the overhead is now bounded, predictable, and decoupled from arbitrary customer-selected parameters that previously caused unpredictable spikes on origin servers and internal networks.

Managing this seamlessly required solving a complex coordination problem: producing a single, accurate response when requested bytes are fragmented across locally cached data, incoming origin responses, and downloads already in flight. Rather than performing a single isolated cache lookup, the edge operates as a coordinator. It can assemble a response using a cached prefix, an ongoing download stream, and a newly fetched suffix. If an existing download is already covering the bytes requested by a second client, that subsequent request can piggyback onto the active download instead of triggering an entirely new origin fetch, efficiently pooling network resources during traffic bursts for popular assets.

To maintain strict data integrity, the system validates representations before composing them. Composed range responses are only valid when every byte belongs to the identical representation. The coordinator rigorously checks that each origin response matches the requested range, that the total asset size remains stable, and that entity tags remain consistent across all subrequests. If a client employs an If-Range header to check file freshness and the validator fails, Cloudflare bypasses composition and serves the full, fresh representation rather than improperly mixing bytes from different file versions. Similarly, Cloudflare avoids composing ranges for representations scheduled for decompression, as the byte layout of compressed data fundamentally differs from decompressed output.

Before rolling the feature out globally, Cloudflare migrated existing users of its legacy range-caching system to the new implementation, prioritizing workloads that experienced the heaviest friction. The primary targets were high-traffic environments characterized by spiky traffic patterns and concurrent range requests against massive files. Internal object storage R2 proved to be the single largest internal user of the legacy system, where a configured range size of 64 megabytes meant a minor read crossing a boundary could generate 128 megabytes of internal data center transfer.

Following the migration of R2 and similar workloads to the Pingora-backed caching architecture, Cloudflare measured a dramatic performance boost. The 99th percentile time to first byte dropped by approximately half, while a subsequent optimization successfully cut tiered cache traffic for R2 workloads by roughly six percent.

With the cache architecture liberated from customer-configured range sizes, product setup has been simplified into a self-service workflow. Rather than tuning numerical parameters or contacting support channels, administrators can enable Origin Range Requests directly through the Cloudflare dashboard under Caching and Cache Rules, or programmatically via the API. The feature is targeted primarily at scenarios where clients naturally request segments of large, cacheable objects, such as media streaming, software updates, and large document downloads. By turning the setting on through a Cache Rule, administrators designate the eligible traffic, leaving the edge network to autonomously handle chunking, byte alignment, and cache coordination.