fix(cf-workers): mark forwarded object responses no-transform - #150
Merged
Merged
Conversation
Cloudflare gzips compressible content types (e.g. text/markdown) on the fly for clients sending Accept-Encoding: gzip, stripping Content-Length and Accept-Ranges from full-object GET/HEAD responses. The Preview smoke tests `test_head_includes_accept_ranges` and `test_range_after_full_get_still_returns_206` have failed on every branch since early August because of it. Add `no-transform` to Cache-Control on forwarded responses so the body is passed through byte-for-byte, keeping any backend Cache-Control directives. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Claude finished @alukach's task in 1m 33s —— View job ✅ No blocking issues — safe to merge. Reviewed
Minor, non-blocking observations:
Simplify (ponytail) Nothing to flag — 💰 Estimated review cost: $0.31 · 1m32s · 15 turns |
|
📖 Docs preview deployed to https://multistore-docs-pr-150.development-seed.workers.dev
|
|
🚀 Latest commit deployed to https://multistore-proxy-pr-150.development-seed.workers.dev
|
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Forwarded responses now append no-transform; assert the stored max-age directive survives alongside it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully deployed
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.
What I'm changing
The Preview smoke tests
TestRangeRequests::test_head_includes_accept_rangesandtest_range_after_full_get_still_returns_206have failed on every branch since early August (the last green run was 2026-07-28).tests/smoke/hasn't changed since June.Cloudflare now gzips full-object Worker responses on the fly for compressible types such as
text/markdown, whenever the client sendsAccept-Encoding: gzip. Pythonrequests, browsers and many HTTP clients send that header by default. Compressing the body stripsContent-LengthandAccept-Ranges. Range responses (206) are never compressed, so only full GET/HEAD responses are affected.This is user-visible, not only a test problem. Any client that plans downloads from a HEAD, such as
aws s3 cpor anything that splits a download into ranges, gets no size or range support for text objects. A proxy should return object bytes and headers as the backend sent them. I reproduced it against the #145 preview deployment:content-lengthaccept-rangescontent-encodingAccept-EncodingAccept-Encoding: gzip, deflateHow I did it
crates/cf-workers/src/response.rs:response_from_forwardcalls a newset_no_transformbefore building theweb_sys::Response. It appendsno-transformtoCache-Controland keeps any directives the backend returned (such asmax-age). If the directive is already present, it does nothing; if there's noCache-Control, it setsno-transform. Cloudflare doesn't compress responses markedno-transform.Forwardpath (streamed object bodies) changes.response_from_proxy_result, which serves small LIST/XML/error bodies, is left alone because compressing those is harmless.docs/deployment/cloudflare-workers.md: new "Response Handling" section. It explains the header, notes that compression also weakens theETag, and shows integrators how to opt out by deletingcache-controlfrom the responseinto_web_sys()returns. The opt-out is a documented header edit rather than a config option; I didn't add a config option because no one has asked for one.Test plan
cargo check -p multistore-cf-workers --target wasm32-unknown-unknowncargo clippy -p multistore-cf-workers --target wasm32-unknown-unknowncargo check,cargo fmtTestRangeRequests. These two tests are the failing regression tests:multistore-cf-workersdoesn't build for the host target, so there's no native unit test forset_no_transform.🤖 Generated with Claude Code