docs/gateway/remote-gateway-readme.md
OpenClaw.app reaches a remote Gateway over an SSH tunnel: an SSH LocalForward maps a local port to the Gateway WebSocket port on the remote host.
flowchart TB
subgraph Client["Client Machine"]
direction TB
A["OpenClaw.app"]
B["ws://127.0.0.1:18789\n(local port)"]
T["SSH Tunnel"]
A --> B
B --> T
end
subgraph Remote["Remote Machine"]
direction TB
C["Gateway WebSocket"]
D["ws://127.0.0.1:18789"]
C --> D
end
T --> C
LocalForward 18789 127.0.0.1:18789 (see Remote Access for the full config block).ssh-copy-id.gateway.remote.token (or gateway.remote.password) via openclaw config set gateway.remote.token "<your-token>".ssh -N remote-gateway &.For a tunnel that survives reboots and reconnects automatically, use the LaunchAgent setup on the Remote Access page instead of a manual ssh -N.
| Component | What it does |
|---|---|
LocalForward 18789 127.0.0.1:18789 | Forwards local port 18789 to remote port 18789 |
ssh -N | SSH without executing remote commands (port forwarding only) |
KeepAlive | Restarts the tunnel automatically if it crashes (LaunchAgent) |
RunAtLoad | Starts the tunnel when the LaunchAgent loads (LaunchAgent) |
OpenClaw.app connects to ws://127.0.0.1:18789 on the client. The tunnel forwards that connection to port 18789 on the remote host running the Gateway.