The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 25, 08:45 UTC
fix(web): use wss:// when page is served over HTTPS (#391)
When T3 Code web mode is accessed via HTTPS (e.g. through a reverse proxy or Tailscale Serve), the WebSocket connection must use wss:// instead of ws://. Browsers block mixed content — an insecure ws:// connection initiated from an HTTPS page. Fix: derive the WebSocket protocol from window.location.protocol. Co-authored-by: PatrickBauer <patrick@patrickbauer.dev>
Patrick Bauer committed
Mar 9, 2026 at 00:30 UTC
6271b989bc72a255483aa96ccb2868ef4655341d
2 files changed
+2
-2
apps/web/src/components/Sidebar.tsx
+1
-1
@@ -225,7 +225,7 @@ function getServerHttpOrigin(): string {
225
? bridgeUrl
226
: envUrl && envUrl.length > 0
227
? envUrl
228
- : `ws://${window.location.hostname}:${window.location.port}`;
228
+ : `${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.hostname}:${window.location.port}`;
229
// Parse to extract just the origin, dropping path/query (e.g. ?token=…)
230
const httpUrl = wsUrl.replace(/^wss:/, "https:").replace(/^ws:/, "http:");
231
try {
apps/web/src/wsTransport.ts
+1
-1
@@ -44,7 +44,7 @@ export class WsTransport {
44
? bridgeUrl
45
: envUrl && envUrl.length > 0
46
? envUrl
47
- : `ws://${window.location.hostname}:${window.location.port}`);
47
+ : `${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.hostname}:${window.location.port}`);
48
this.connect();
49
}
50