From b70b4d1fc92f170e948ba7b9ef53b7314b411724 Mon Sep 17 00:00:00 2001 From: Moepchi Date: Tue, 11 Aug 2026 02:17:53 +0200 Subject: [PATCH] Fix: VITE_GATEWAY_URL override was missing the /ws path The gateway's WebSocketServer only listens on /ws (gateway/src/index.ts), but the VITE_GATEWAY_URL build-time override connected to the bare host instead - causing 'Could not reach the gateway' on split-hosted deploys (e.g. client.webspeak3.de -> gateway.webspeak3.de). Now /ws is always appended, whether the URL comes from the same-origin fallback or the override. Co-Authored-By: Claude Sonnet 5 --- web/src/App.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/web/src/App.tsx b/web/src/App.tsx index ac59285..4184177 100644 --- a/web/src/App.tsx +++ b/web/src/App.tsx @@ -52,10 +52,14 @@ import { parseSoundpack } from "./soundpack"; // VITE_GATEWAY_URL at build time to the gateway's public wss:// address // instead - the browser will still block a plain ws:// gateway from an // https:// page (mixed content), so that address needs real TLS. +// Either way the gateway's WebSocketServer only listens on /ws (see +// gateway/src/index.ts), so that path always gets appended here - a +// VITE_GATEWAY_URL override only needs to name the host, not the path. const GATEWAY_URL = import.meta.env.DEV ? "ws://localhost:8080" - : import.meta.env.VITE_GATEWAY_URL || - `${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.host}/ws`; + : import.meta.env.VITE_GATEWAY_URL + ? `${import.meta.env.VITE_GATEWAY_URL.replace(/\/$/, "")}/ws` + : `${window.location.protocol === "https:" ? "wss" : "ws"}://${window.location.host}/ws`; // One-time migration from the pre-rename "ts-web-client:*" localStorage // namespace so existing users don't lose their favorites/preferences.