Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

fix(desktop): strip Origin header from WebSocket requests (#842)

Bohan Jiangdbc6308c207c
diff --git a/apps/desktop/src/main/index.ts b/apps/desktop/src/main/index.ts
index 2113a8e0ea..9dfe6521fc 100644
--- a/apps/desktop/src/main/index.ts
+++ b/apps/desktop/src/main/index.ts
@@ -44,6 +44,16 @@ function createWindow(): void {
},
});
+ // Strip Origin header from WebSocket upgrade requests so the server's
+ // origin whitelist doesn't reject connections from localhost dev origins.
+ mainWindow.webContents.session.webRequest.onBeforeSendHeaders(
+ { urls: ["wss://*/*", "ws://*/*"] },
+ (details, callback) => {
+ delete details.requestHeaders["Origin"];
+ callback({ requestHeaders: details.requestHeaders });
+ },
+ );
+
mainWindow.on("ready-to-show", () => {
mainWindow?.show();
});