Catalog / Cloudflare Developer Platform

Cache - Configure Origin Range Requests with the Rulesets API

12 days agoOriginal notes

The Rulesets API now supports Origin Range Requests in Cache Rules. This setting lets Cloudflare fetch large files from your origin in cache-aligned byte ranges. Cloudflare may expand a client range and issue several single-range origin requests.

Set origin_range_requests.mode to on, off, or default for any traffic matched by a Cache Rule.

To override Cloudflare's default Origin Range Requests behavior, set the mode to off. The following rule turns off generated origin range requests for all traffic without changing cache eligibility:

{
  "expression": "true",
  "action": "set_cache_settings",
  "action_parameters": {
    "origin_range_requests": {
      "mode": "off"
    }
  }
}

Origin Range Requests do not make otherwise ineligible content cacheable. If your origin ignores Range and returns a complete 200 OK, Cloudflare can use the response but must download the complete file. Origins should honor Accept-Encoding: identity and return consistent, unencoded partial responses.

For configuration details and mode behavior, refer to Origin Range Requests in Cache Rules. For client responses and the complete origin contract, refer to Range request behavior.