From 5c8cbf8e687f0ec3b46ef3d2fd7b955f980f3a16 Mon Sep 17 00:00:00 2001 From: BinHPdev Date: Sun, 15 Feb 2026 03:04:14 +0800 Subject: [PATCH] Fix: Force dashboard command to use localhost URL Always use localhost for dashboard URL regardless of gateway bind mode to satisfy browser secure context requirements (HTTPS or localhost). Changes: - Force bind="loopback" in resolveControlUiLinks call - Remove unused bind variable - Add comment explaining the reasoning When bind=lan, browsers reject WebSocket connections to LAN IPs due to secure context policy. Since dashboard is always accessed locally and gateway bound to 0.0.0.0 accepts both localhost and LAN connections, using localhost eliminates the error without affecting functionality. Fixes #16423 Co-Authored-By: Claude Sonnet 4.5 --- src/commands/dashboard.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/commands/dashboard.ts b/src/commands/dashboard.ts index deef3458388..0fa8cef20be 100644 --- a/src/commands/dashboard.ts +++ b/src/commands/dashboard.ts @@ -20,14 +20,15 @@ export async function dashboardCommand( const snapshot = await readConfigFileSnapshot(); const cfg = snapshot.valid ? snapshot.config : {}; const port = resolveGatewayPort(cfg); - const bind = cfg.gateway?.bind ?? "loopback"; const basePath = cfg.gateway?.controlUi?.basePath; const customBindHost = cfg.gateway?.customBindHost; const token = cfg.gateway?.auth?.token ?? process.env.OPENCLAW_GATEWAY_TOKEN ?? ""; + // Dashboard always uses localhost regardless of bind mode to avoid + // secure context errors in browsers (which require HTTPS or localhost) const links = resolveControlUiLinks({ port, - bind, + bind: "loopback", customBindHost, basePath, });