Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions microfrontend-template/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,14 @@ async function handleMountedApp(
const upstreamResp = await upstream.fetch(
new Request(forwardUrl.toString(), request),
);

// WebSocket upgrades must be returned as-is — do not wrap in a new Response,
// as that would strip the WebSocket pair from the response and break the connection.
// This applies to Durable Objects, Agents SDK, PartyKit, and any other WebSocket upgrade.
if (upstreamResp.status === 101) {
return upstreamResp;
}

const headers = new Headers(upstreamResp.headers);
const contentType = headers.get("content-type") || "";

Expand Down