Skip to content

Can't connect to OpenClaw behind Tailscale Serve (hardcoded localhost/port, WS fails) #19

Closed

Description

@mekwall

I have OpenClaw running on macOS and exposed to my tailnet using tailscale serve. The dashboard loads fine in a browser via the Serve URL, but the openclaw-windows-hub app cannot connect, even when I try wss://.

This looks like the Windows Hub assumes a local gateway (ws://localhost:18789) and/or assumes it can reach the gateway on the backend port, which breaks when the gateway is behind Tailscale Serve (HTTPS on 443 proxying to 127.0.0.1:18789).

Environment

  • Host: macOS (OpenClaw gateway running locally on 127.0.0.1:18789)
  • Exposure: Tailscale Serve (tailnet only)
  • Client: Windows 11, same tailnet, using openclaw-windows-hub

Tailscale Serve status (host)

tailscale serve status shows:

https://mekbook.tail1e276.ts.net (tailnet only)
|-- / proxy http://127.0.0.1:18789

What works

  • From Windows browser:
    • https://mekbook.tail1e276.ts.net/ loads the OpenClaw dashboard successfully

What doesn't work

  • From Windows browser:
    • WebSocket functionality in the dashboard does not work (UI loads but the app is non-functional because WS doesn't connect)
  • From openclaw-windows-hub:
    • Cannot connect to the gateway via the Serve hostname
    • Trying ws://mekbook.tail1e276.ts.net:18789 fails (Serve does not expose the backend port)
    • Trying wss://mekbook.tail1e276.ts.net/... also fails (likely because the app assumes localhost/port/path and/or does not support remote HTTPS/WSS properly)

Expected behavior

Windows Hub should be able to connect to a gateway exposed via Tailscale Serve by using:

  • https://<host>.tail*.ts.net/ for the base URL, and
  • wss://<host>.tail*.ts.net/<ws-path> for WebSockets,
    without assuming localhost or :18789.

Suspected root cause

  • Windows Hub hardcodes or defaults to ws://localhost:18789 (or otherwise assumes local gateway semantics)
  • No proper support for remote https:///wss:// gateway URLs
  • Possibly constructs WS URLs incorrectly when the gateway is accessed via HTTPS (mixed content, wrong port, wrong origin)

Suggested fix

  • Allow configuring a remote base URL (https://...) and derive the WS URL from it:
    • Prefer same-origin wss:// when base is HTTPS
    • Do not append :18789 when using Tailscale Serve (Serve is on 443 and proxies internally)
  • Improve logging/error reporting for the WS connection attempt (show the computed WS URL and the close reason)

Repro steps

  1. Run OpenClaw gateway on macOS bound to 127.0.0.1:18789
  2. Expose with tailscale serve:
    • https://<host>.tail*.ts.net/ -> http://127.0.0.1:18789
  3. On Windows (same tailnet), open https://<host>.tail*.ts.net/ (dashboard loads)
  4. Try using openclaw-windows-hub to connect to that gateway (fails; WS doesn't connect)

Activity

  1. gavinfaux commented on Feb 17, 2026

    @gavinfaux

    Just a note, wss: works for me, e.g. wss://device.tail-your-id.ts.net/

  2. added a commit that references this issue on Feb 17, 2026
  3. shanselman commented on Feb 17, 2026

    @shanselman
    Collaborator

    Fixed in f78d2ed: shared GatewayUrlHelper now normalizes ws/wss/http/https consistently across OpenClawGatewayClient and WindowsNodeClient, with settings validation updated and tests added.

  4. locked as resolved and limited conversation to collaborators on May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Fields

Priority

None yet

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions