Cloudflare's faster video and download caching is opt-in
Summary
Cloudflare's rebuilt cache for range requests is now self-service on all plans, and it roughly halved p99 time to first byte for the company's own R2 object storage.
Anyone serving video, audio or large downloads needs a Cache Rule with Origin Range Requests set to On, since nothing changes until that rule exists.
Cloudflare rebuilt how its cache handles requests for part of a file, and any zone can now turn the new version on. Cloudflare’s post names the feature Origin Range Requests, announced October 23 and available on all plans. It switches on through a Cache Rule, with no range size to pick and no support ticket.
The figures come from Cloudflare’s own storage. R2, its object storage product, was the heaviest user of the old range-caching feature at a 64 MiB range size, and after the move its p99 time to first byte dropped by roughly half on both cache hits and misses. A later change, which let the cache combine bytes it already held with bytes it fetched into a single response, cut tiered cache traffic for R2 and similar workloads by about 6% week over week.
Range requests are how a client asks for a slice of a large file instead of the whole thing: a video player seeking into the middle of a movie, or a download manager resuming after a dropped connection. Cloudflare’s old implementation mapped each of those onto fixed ranges whose size every zone configured by hand, and that size was part of the cache key, so changing it threw away what had already been cached. Set it small and the origin saw a flood of small requests. Set it large and a seek worth a few megabytes could make Cloudflare pull 128 MiB from the origin and move it between data centers, sometimes after the viewer had already left. Concurrent requests that landed inside the same range could block each other, and the old nginx-based cache could not run range caching alongside concurrent streaming, the feature that lets several clients read a file from cache while it is still being written.
The replacement borrows something the new cache was already doing. Pingora, the proxy software Cloudflare built to replace nginx, stores every cached file on disk in fixed-size chunks, so the range size stops being a setting and becomes the chunk. A request for bytes 150 to 250 makes Cloudflare fetch the aligned chunk those bytes sit in and store it the way it stores any other cached body. The client still receives only the bytes it asked for. Small requests therefore still drag a whole chunk along, and the gain is that the extra work is bounded by the chunk size rather than by a range size someone once set on the zone. When a download already in flight covers a second request’s bytes, that request attaches to it instead of opening another origin fetch.
Before opening the feature up, Cloudflare migrated the existing users of the old range-caching setting, starting with the workloads that hurt it most. So the zones that got the improvement for free are the ones that had already configured a range size under the old system. Cloudflare’s post does not say this, but the larger group is everywhere else: a site serving progressive video, installers, disk images or model weights that never touched the old setting has no range caching today and will not see the halved p99 until someone writes the rule.
What to do
- In the dashboard, go to Caching > Cache Rules and create a rule matching the large-file traffic, by path, extension or hostname, with Origin Range Requests set to On. On the API the field is
"origin_range_requests": { "mode": "on" }. - Check the responses afterwards. A satisfiable range should return 206 with an accurate
Content-Range, and an unsatisfiable one should return 416. - Keep ETags stable on large files. When a client sends
If-Rangeand the validator no longer matches, Cloudflare serves the full representation rather than composing bytes from two versions, which is correct but puts the whole file on the wire. - Do not expect partial responses on anything Cloudflare decompresses before serving. A range over compressed bytes selects different bytes than the same range over the decompressed response, so Cloudflare sends the complete transformed response instead.