Repository navigation
Conversation
Release-note: Fix: Cloud apps can connect to upstream WebSocket services.
Instead of special-casing status 101, return every native Response from the Cloud outbound gateway via HttpServerResponse.raw with its status and statusText. This keeps workerd WebSocket upgrades attached, avoids re-wrapping every outbound HTTP stream through Effect Stream, and lets Effect's HttpServerResponse.toWeb handle bodyless statuses (204/304/HEAD). Expand the Cloud outbound WebSocket e2e scenario to also cover standard new WebSocket(...) connections, credentialed upgrades, and 204 responses.
This branch has not been 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.
Summary
Cloud apps fail to open WebSocket connections to upstream services even when the upstream accepts the upgrade. The outbound gateway converts the upstream
101 Switching Protocolsresponse withHttpServerResponse.fromWeb, which drops Cloudflare'sResponse.webSockethandle before the response reaches the app.Responsefrom the Cloud outbound gateway viaHttpServerResponse.raw(response, { status: response.status, statusText: response.statusText })so workerd keepsResponse.webSocketattached and avoids re-wrapping outbound HTTP response bodies through Effect streams, while Effect'sHttpServerResponse.toWebstill handles bodyless statuses (204/205/304/HEAD).fetchupgrade,new WebSocket(...), and a credentialed upgrade) plus ordinary (202) and bodyless (204) HTTP responses from a deployed app on managed Cloud.Verification
cloud-outbound-websocket.spec.ts(fetch101 upgrade,new WebSocket(...), credentialed WebSocket upgrade, 202 HTTP, and 204 No Content),app-fetch-brotli.spec.ts, andapp-egress-failures.spec.ts.bun run e2e:outbound-routespassed.bun run checkpassed all 19 checks.CI test selection