Fix #64, add range header forwarding - #147
Open
fangpenlin wants to merge 5 commits into
Open
Conversation
Clients may resume or probe a blob with the RFC 9110 suffix form 'Range: bytes=-<n>', asking for the last n bytes. That form was parsed as malformed and silently downgraded to a full 200 response. Model BlobRangeRequest as a union of an offset range and a suffix range, resolve suffixes against the object size in the R2 backend, and forward them upstream verbatim. A suffix longer than the object is satisfied by the whole object, while a zero-length suffix is unsatisfiable. Co-authored-by: Fang-Pen Lin <hello@fangpenlin.com>
When a blob is not cached in R2, the blob GET handler falls back to the configured upstream registries. Any error from an upstream was treated as a miss, so an unsatisfiable range reached the client as a synthetic 404 BLOB_UNKNOWN, telling it the blob does not exist and discarding the Content-Range that carries the real object size. Report a 416 from an upstream directly, matching how a 416 from the primary R2 store is already handled. Other failures keep falling through to the next registry. Co-authored-by: Fang-Pen Lin <hello@fangpenlin.com>
pnpm format:check was failing on this branch because the getLayer signature was wrapped across multiple lines where prettier wants it on one. Co-authored-by: Fang-Pen Lin <hello@fangpenlin.com>
fangpenlin
marked this pull request as ready for review
August 13, 2026 00:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Originally the worker doesn't handle
Rangeheader, as a result, if a big layer connection drops, and the client try to resume the progress sendingRangeheader, it will fail. The issue can be found #64This PR implements the
Rangeheader forwarding to solve the problem