Skip to content

Fix: Force dashboard command to use localhost URL#16434

Merged
gumadeiras merged 3 commits intoopenclaw:mainfrom
BinHPdev:fix-dashboard-localhost
Feb 14, 2026
Merged

Fix: Force dashboard command to use localhost URL#16434
gumadeiras merged 3 commits intoopenclaw:mainfrom
BinHPdev:fix-dashboard-localhost

Conversation

@BinHPdev
Copy link
Copy Markdown
Contributor

@BinHPdev BinHPdev commented Feb 14, 2026

Summary

Fixes #16423 - Dashboard now uses localhost URL to avoid browser secure context errors

Problem

When gateway.bind="lan", the openclaw dashboard command generated URLs with LAN IP (e.g., http://192.168.31.137:18789/). Browsers rejected WebSocket connections to these URLs due to secure context policy requiring "HTTPS or localhost."

Solution

Force dashboard command to always use localhost (127.0.0.1) regardless of gateway bind configuration.

Changes

Modified src/commands/dashboard.ts:

  • Force bind: "loopback" in resolveControlUiLinks() call
  • Removed unused bind variable
  • Added explanatory comment

Rationale

  • Dashboard is local-only: Always accessed from the same machine as gateway
  • Gateway accepts both: When bound to 0.0.0.0 or LAN, still accepts localhost connections
  • Browser security: Localhost satisfies secure context without requiring HTTPS
  • No functionality loss: All features work identically via localhost

Before

const bind = cfg.gateway?.bind ?? "loopback";
const links = resolveControlUiLinks({
  port,
  bind,  // Uses LAN IP when bind="lan"
  customBindHost,
  basePath,
});

After

// Dashboard always uses localhost regardless of bind mode
const links = resolveControlUiLinks({
  port,
  bind: "loopback",  // Always localhost
  customBindHost,
  basePath,
});

Testing

  • ✅ Lint check passed
  • ✅ Format check passed

🤖 Generated with Claude Code

Greptile Overview

Greptile Summary

Forces dashboard command to always use localhost (127.0.0.1) instead of respecting gateway.bind configuration. This prevents browser secure context errors when gateway is bound to LAN IP addresses, since browsers require HTTPS or localhost for WebSocket connections. The change is safe because:

  • The dashboard is always accessed locally from the same machine as the gateway
  • Gateway accepts localhost connections even when bound to 0.0.0.0 or LAN addresses
  • The status command (src/commands/status.command.ts:199-206) still respects the bind configuration for display purposes
  • Tests verify the behavior expects bind: "loopback" (src/commands/dashboard.e2e.test.ts:80-85)

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is minimal, well-justified, and correctly addresses a browser security policy issue. The hardcoded bind: "loopback" is appropriate for dashboard command since it's always accessed locally. Tests confirm the expected behavior, and the change doesn't affect other parts of the system (status command still shows actual bind configuration).
  • No files require special attention

Last reviewed commit: dda36bb

@openclaw-barnacle openclaw-barnacle bot added commands Command implementations size: XS labels Feb 14, 2026
@gumadeiras gumadeiras self-assigned this Feb 14, 2026
@BinHPdev BinHPdev force-pushed the fix-dashboard-localhost branch 2 times, most recently from 348a633 to e9117ea Compare February 14, 2026 19:46
@openclaw-barnacle openclaw-barnacle bot added the app: macos App: macos label Feb 14, 2026
@gumadeiras gumadeiras force-pushed the fix-dashboard-localhost branch from e9117ea to f2640d0 Compare February 14, 2026 20:00
BinHPdev and others added 3 commits February 14, 2026 15:00
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 openclaw#16423

Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
@gumadeiras gumadeiras force-pushed the fix-dashboard-localhost branch from f2640d0 to 3c03b4c Compare February 14, 2026 20:00
@gumadeiras gumadeiras merged commit b9d1485 into openclaw:main Feb 14, 2026
9 checks passed
@gumadeiras
Copy link
Copy Markdown
Member

Merged via squash.

Thanks @BinHPdev!

philga7 pushed a commit to philga7/openclaw-fork that referenced this pull request Feb 14, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 3c03b4c
Co-authored-by: BinHPdev <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
@BinHPdev BinHPdev deleted the fix-dashboard-localhost branch February 15, 2026 01:03
akoscz pushed a commit to akoscz/openclaw that referenced this pull request Feb 15, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 3c03b4c
Co-authored-by: BinHPdev <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
GwonHyeok pushed a commit to learners-superpumped/openclaw that referenced this pull request Feb 15, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 3c03b4c
Co-authored-by: BinHPdev <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
vincentkoc pushed a commit to vincentkoc/openclaw that referenced this pull request Feb 15, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 3c03b4c
Co-authored-by: BinHPdev <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
snowzlm pushed a commit to snowzlm/openclaw that referenced this pull request Feb 15, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 3c03b4c
Co-authored-by: BinHPdev <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 1, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 3c03b4c
Co-authored-by: BinHPdev <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras

(cherry picked from commit b9d1485)

# Conflicts:
#	CHANGELOG.md
#	src/commands/dashboard.test.ts
hughdidit pushed a commit to hughdidit/DAISy-Agency that referenced this pull request Mar 3, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 3c03b4c
Co-authored-by: BinHPdev <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras

(cherry picked from commit b9d1485)

# Conflicts:
#	CHANGELOG.md
#	src/commands/dashboard.test.ts
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 3c03b4c
Co-authored-by: BinHPdev <[email protected]>
Co-authored-by: gumadeiras <[email protected]>
Reviewed-by: @gumadeiras
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos commands Command implementations size: S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

openclaw dashboard outputs LAN IP instead of localhost when bind=lan, causing secure context error

2 participants