如何将OpenClaw macOS Mac mini Tailscale Serve远程访问从离线状态稳定修复?

摘要:这篇文章记录一次典型的 OpenClaw Control UI 远程访问踩坑过程:在 macOS 的 Mac mini 上运行 OpenClaw(Web UI 端口 18789),希望在另一台同一 Tailnet 内的 MacBook 上访
这篇文章记录一次典型的 OpenClaw Control UI 远程访问踩坑过程:在 macOS 的 Mac mini 上运行 OpenClaw(Web UI 端口 18789),希望在另一台同一 Tailnet 内的 MacBook 上访问。过程会遇到 DNS、证书、Tailscale Serve、Origin 校验、Proxy 信任与 Pairing 等一串“看起来像一个问题、实际是多层叠加”的故障。 最终的目标是: 本机仍然用 http://127.0.0.1:18789 正常访问与聊天 远端(Tailnet 内)用 https://<host>.tailxxxx.ts.net/ 安全访问 不必开启 “Use Tailscale DNS settings”(它可能导致“开了就断网”) 页面不再提示离线、版本不适用、origin not allowed、pairing-required 等 0. 你遇到的现象通常长这样 现象 A:远端访问 <tailscale-ip>:18789 连接不上 因为 OpenClaw 默认只监听 127.0.0.1(loopback),外部 IP 上并没有监听 18789。 现象 B:Tailscale Serve 显示启动成功,但 curl https://<host>.ts.net/ 报 TLS 错 典型错误: LibreSSL ... tlsv1 alert internal error tailscale cert ... lookup acme-v02.api.letsencrypt.org: no such host 本质通常是 DNS / 出网访问 Let’s Encrypt (ACME) 失败。 现象 C:远端终于能打开网页,但 UI 显示: origin not allowed (open the Control UI from the gateway host or allow it in gateway.controlUi.allowedOrigins) “版本 不适用 / 健康状况 离线” 说明前端页面能加载,但 WebSocket/后端握手失败。 现象 D:配好 allowedOrigins 仍然离线,日志出现: Proxy headers detected from untrusted address... Configure gateway.trustedProxies... cause: pairing-required ... reason: not-paired ... code=4008 说明你已经通过反代(Tailscale Serve)进来了,但网关认为代理头“不可信”,导致本地判定失效,进而触发更严格的 pairing 流程。 1. 推荐的正确架构(避免把 18789 直接暴露给 Tailnet/LAN) 不要把 OpenClaw gateway 直接绑到 lan 或 tailnet 然后在远端访问 http://100.x.x.x:18789。 更稳健、更安全的方式是: OpenClaw 仍然只监听 127.0.0.1:18789 用 tailscale serve 在 Tailnet 内提供 HTTPS 入口(通常 443) 远端访问 https://<host>.tailxxxx.ts.net/ 这可以避免: 直接暴露控制面到整个局域网 自己折腾 HTTPS 反代/证书 一些 UI 对 “非 localhost 的 http” 产生 secure context 问题 2. Step 1:先确认 OpenClaw 本机端口健康 在 Mac mini 上: curl -I http://127.0.0.1:18789 lsof -nP -iTCP:18789 -sTCP:LISTEN 只要能连上、能看到 LISTEN(200/302/401 都行),就说明 OpenClaw 网关本地没问题。
阅读全文