Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

fix(web): use wss:// when page is served over HTTPS (#391)

Patrick Bauer6271b989bc72
diff --git a/apps/web/src/components/Sidebar.tsx b/apps/web/src/components/Sidebar.tsx
index e3a3ce02e..2a96f9e9f 100644
--- a/apps/web/src/components/Sidebar.tsx
+++ b/apps/web/src/components/Sidebar.tsx
@@ -225,7 +225,7 @@ function getServerHttpOrigin(): string {
? bridgeUrl
: envUrl && envUrl.length > 0
? envUrl
- : `ws://${window.location.hostname}:${window.location.port}`;
+ : `${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.hostname}:${window.location.port}`;
// Parse to extract just the origin, dropping path/query (e.g. ?token=…)
const httpUrl = wsUrl.replace(/^wss:/, "https:").replace(/^ws:/, "http:");
try {
diff --git a/apps/web/src/wsTransport.ts b/apps/web/src/wsTransport.ts
index ef9dddb34..faac325a7 100644
--- a/apps/web/src/wsTransport.ts
+++ b/apps/web/src/wsTransport.ts
@@ -44,7 +44,7 @@ export class WsTransport {
? bridgeUrl
: envUrl && envUrl.length > 0
? envUrl
- : `ws://${window.location.hostname}:${window.location.port}`);
+ : `${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.hostname}:${window.location.port}`);
this.connect();
}