From 578d84c25e62563cd48e1be876b5d6735daa9659 Mon Sep 17 00:00:00 2001 From: ruv Date: Mon, 16 Mar 2026 11:35:11 -0400 Subject: [PATCH] fix(ui): WebSocket protocol matches page protocol, not hostname (#272) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit buildWsUrl() forced wss:// on non-localhost HTTP connections, breaking LAN/Docker deployments at http://192.168.x.x:3000. Now simply: https → wss, http → ws. Closes #272 Co-Authored-By: claude-flow --- ui/config/api.config.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ui/config/api.config.js b/ui/config/api.config.js index c4750996..a8109182 100644 --- a/ui/config/api.config.js +++ b/ui/config/api.config.js @@ -113,11 +113,11 @@ export function buildApiUrl(endpoint, params = {}) { // Helper function to build WebSocket URLs export function buildWsUrl(endpoint, params = {}) { - // Use secure WebSocket (wss://) when serving over HTTPS or on non-localhost - // Use ws:// only for localhost development - const isLocalhost = window.location.hostname === 'localhost' || window.location.hostname === '127.0.0.1'; + // Match WebSocket protocol to page protocol: https → wss, http → ws. + // Previous logic forced wss:// on non-localhost HTTP, breaking LAN/Docker + // deployments served over plain HTTP. See issue #272. const isSecure = window.location.protocol === 'https:'; - const protocol = (isSecure || !isLocalhost) + const protocol = isSecure ? API_CONFIG.WSS_PREFIX : API_CONFIG.WS_PREFIX;