fix: default to 0.0.0.0 to fix WSL2 health check failure (#520)

PR #470 changed the default listen host to undefined, letting Node.js
bind to IPv6 :: on systems that support it. This broke WSL2 where IPv6
dual-stack is unreliable — the server binds to :: but IPv4 127.0.0.1
connections fail, causing the health check to time out.

Revert to 0.0.0.0 as the default. Users who need IPv6 can set
BIND_HOST=:: explicitly.

Fixes #518

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
ekko
2026-05-07 19:11:32 +08:00
committed by GitHub
parent 8f6a6ec782
commit f1839db473
8 changed files with 171 additions and 130 deletions
@@ -265,6 +265,13 @@ const terminalBg = computed(
// ─── WebSocket ──────────────────────────────────────────────────
function formatHostForPort(hostname: string, port: number): string {
if (hostname.startsWith("[") && hostname.endsWith("]")) {
return `${hostname}:${port}`;
}
return hostname.includes(":") ? `[${hostname}]:${port}` : `${hostname}:${port}`;
}
function buildWsUrl(): string {
const token = getApiKey();
const base = getBaseUrlValue();
@@ -282,7 +289,7 @@ function buildWsUrl(): string {
// Dev mode: connect directly to backend port; Production: same host
const host = import.meta.env.DEV
? `${location.hostname}:8648`
? formatHostForPort(location.hostname, 8648)
: location.host;
return `${wsProtocol}//${host}/api/hermes/terminal${token ? `?token=${encodeURIComponent(token)}` : ""}`;
}