Stream proxied bodies through the worker unchanged - #5
Merged
Merged
Conversation
The proxy converted every request and response into http types, which copied each body chunk through Wasm memory. Large uploads (a 96 MB Playwright trace) used seconds of CPU and hit Cloudflare's resource limit. The runtime then terminated the request, cancelling the Wasm executor's queued microtask, and every later request on that isolate hung with error 1101. Proxy requests now forward the original JS body streams in both directions and only rewrite headers. Uploads also keep their Content-Length instead of arriving chunked. Only /linkup routes still go through the axum router.
worker 0.8 reinitializes the Wasm instance after a Rust panic or a JavaScript error passes through Wasm, so one failed request no longer leaves the isolate broken for every request that follows. worker-build 0.8 emits build/index.js and build/index_bg.wasm, so the CLI now embeds and uploads those instead of shim.mjs and index.wasm.
luax
force-pushed
the
ludvig/proxy-stream-with-upgrade
branch
from
September 28, 2026 13:00
a0089a3 to
367e6e3
Compare
ostenbom
added a commit
that referenced
this pull request
Sep 29, 2026
PR #5 rebuilt upstream requests with the default redirect mode (`follow`), causing the Worker to follow OAuth callback redirects itself. The browser received the final response instead of the redirect and its authentication cookies, breaking SSO through Linkup. Set the upstream redirect mode to `Manual` while preserving streamed bodies. Add a Worker integration test that verifies the 303 status, Location header, and both Set-Cookie headers reach the client. Update Wrangler entry points and CI placeholder artifacts to the worker-build 0.8 output paths so CI runs the current Worker. Validation: - The new regression test failed before the fix (200 instead of 303) and passed afterward. - All 11 server integration tests passed with the local Worker running (`cargo test -p linkup-server-tests -- --include-ignored`). - `worker-build --release`, `cargo fmt --all --check`, and `git diff --check` passed. The Worker needs redeploying for the fix to take effect; live Google SSO has not been retested.
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.
Proxied request and response bodies now pass through the worker as the original streams so that large uploads no longer exhaust the worker's resources and leave the isolate failing every request with 1101. This also upgrades worker to 0.8.7 so that the Wasm instance recovers after a panic.
The shim is the JavaScript entry file that worker-build generates to load the Wasm and forward requests into Rust. worker-build 0.8 now writes it as build/index.js with build/index_bg.wasm instead of build/worker/shim.mjs with index.wasm, so the CLI embeds and uploads those files instead.