Skip to content

Conversation

@lidel
Copy link
Member

@lidel lidel commented Sep 25, 2025

Adds Config.MaxRangeRequestFileSize to protect against CDN issues with large file range requests. when set, range requests for files larger than this limit return HTTP 501 with suggestion to use verifiable block requests (application/vnd.ipld.raw).

Intention here is to protect against Cloudflare's issue where range requests for files over 5GiB are silently ignored, causing entire file to be returned instead of requested range, leading to excess bandwidth and billing.

The fix here shouldengage when cloudflare sends very first range request to boxo/gateway backend. The backend is able to detect range request for a file beyond safe size, and refuse responding.

@codecov
Copy link

codecov bot commented Sep 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.71%. Comparing base (260f4b3) to head (ee38395).
⚠️ Report is 1 commits behind head on main.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1043      +/-   ##
==========================================
+ Coverage   60.68%   60.71%   +0.03%     
==========================================
  Files         268      268              
  Lines       33588    33593       +5     
==========================================
+ Hits        20383    20397      +14     
+ Misses      11531    11520      -11     
- Partials     1674     1676       +2     
Files with missing lines Coverage Δ
gateway/gateway.go 79.31% <ø> (ø)
gateway/handler_unixfs_file.go 85.00% <100.00%> (+1.36%) ⬆️

... and 8 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

adds Config.MaxRangeRequestFileSize to protect against CDN issues
with large file range requests. when set, range requests for files
larger than this limit return HTTP 501 with suggestion to use
verifiable block requests (application/vnd.ipld.raw).

protects against Cloudflare's issue where range requests for files
over 5GiB are silently ignored, causing entire file to be returned
instead of requested range, leading to excess bandwidth and billing.

Closes #856
@lidel lidel force-pushed the feat/max-range-request-file-size branch from 9bf5946 to 5c16939 Compare September 25, 2025 21:02
@lidel lidel requested a review from hsanjuan September 25, 2025 21:03
@lidel lidel marked this pull request as ready for review September 25, 2025 21:46
@lidel lidel requested a review from a team as a code owner September 25, 2025 21:46
@cewood
Copy link
Contributor

cewood commented Sep 26, 2025

Should the Shareness tests get updated first? Seems like bad hygiene to run those tests if they aren't of significance here. 🤔

@lidel lidel merged commit 4c0aa3a into main Sep 26, 2025
22 of 23 checks passed
@lidel lidel deleted the feat/max-range-request-file-size branch September 26, 2025 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants