Skip to content
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion handlers.client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,12 @@ async function handleWebSocket(
message: RequestStartMessage,
state: ClientState,
) {
const ws = new WebSocket(new URL(message.url, state.localAddr));
const target = new URL(message.url, state.localAddr);
// Coerce http(s): -> ws(s): so spec-strict runtimes (e.g. Bun) accept it.
// Node's undici silently rewrites the scheme, but Bun keeps `http:` and
// the handshake fails immediately, breaking HMR (Vite/Next) through the tunnel.
target.protocol = target.protocol === "https:" ? "wss:" : "ws:";
const ws = new WebSocket(target);
try {
const wsCh = await makeWebSocket<ArrayBuffer, ArrayBuffer, ArrayBuffer>(
ws,
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading