OpenClaw 可以自動設定 Tailscale Serve(tailnet)或 Funnel(公開)供 Gateway 儀表板與 WebSocket 連接埠使用。這會讓 Gateway 繫結在回送位址,同時由 Tailscale 提供 HTTPS、路由,以及(針對 Serve)身分標頭。Documentation Index
Fetch the complete documentation index at: https://docs.openclaw.ai/llms.txt
Use this file to discover all available pages before exploring further.
模式
serve:透過tailscale serve使用僅限 tailnet 的 Serve。Gateway 會維持在127.0.0.1。funnel:透過tailscale funnel使用公開 HTTPS。OpenClaw 需要共用密碼。off:預設值(無 Tailscale 自動化)。
off 表示 OpenClaw 未管理 Serve 或 Funnel;這不表示本機
Tailscale daemon 已停止或登出。
身份驗證
設定gateway.auth.mode 以控制交握:
none(僅限私人入口)token(設定OPENCLAW_GATEWAY_TOKEN時的預設值)password(透過OPENCLAW_GATEWAY_PASSWORD或設定檔使用共用密鑰)trusted-proxy(具身分感知能力的反向代理;請參閱受信任代理身份驗證)
tailscale.mode = "serve" 且 gateway.auth.allowTailscale 為 true 時,
Control UI/WebSocket 身份驗證可以使用 Tailscale 身分標頭
(tailscale-user-login),而不需要提供權杖/密碼。OpenClaw 會透過本機 Tailscale
daemon(tailscale whois)解析 x-forwarded-for 位址,並在接受之前將其與標頭比對,以驗證
該身分。
OpenClaw 只有在請求來自回送位址,且帶有 Tailscale 的 x-forwarded-for、x-forwarded-proto 與 x-forwarded-host
標頭時,才會將請求視為 Serve。
對於包含瀏覽器裝置身分的 Control UI 操作者工作階段,這個已驗證的 Serve 路徑也會略過裝置配對往返。它不會繞過
瀏覽器裝置身分:沒有裝置身分的用戶端仍會被拒絕,而節點角色
或非 Control UI 的 WebSocket 連線仍會遵循一般配對與
身份驗證檢查。
HTTP API 端點(例如 /v1/*、/tools/invoke 與 /api/channels/*)
不會使用 Tailscale 身分標頭身份驗證。它們仍會遵循 Gateway 的
一般 HTTP 身份驗證模式:預設為共用密鑰身份驗證,或是刻意設定的
受信任代理 / 私人入口 none 設定。
這個無權杖流程假設 Gateway 主機是受信任的。如果不受信任的本機程式碼
可能在同一台主機上執行,請停用 gateway.auth.allowTailscale,並改為要求
權杖/密碼身份驗證。
若要要求明確的共用密鑰憑證,請設定 gateway.auth.allowTailscale: false
並使用 gateway.auth.mode: "token" 或 "password"。
設定範例
僅限 Tailnet(Serve)
https://<magicdns>/(或你設定的 gateway.controlUi.basePath)
僅限 Tailnet(繫結至 Tailnet IP)
當你希望 Gateway 直接在 Tailnet IP 上監聽時使用此設定(無 Serve/Funnel)。- Control UI:
http://<tailscale-ip>:18789/ - WebSocket:
ws://<tailscale-ip>:18789
在此模式中,回送位址(
http://127.0.0.1:18789)將無法運作。公開網際網路(Funnel + 共用密碼)
OPENCLAW_GATEWAY_PASSWORD,而不是將密碼提交到磁碟。
CLI 範例
注意事項
- Tailscale Serve/Funnel 需要已安裝且已登入的
tailscaleCLI。 tailscale.mode: "funnel"會拒絕啟動,除非身份驗證模式為password,以避免公開暴露。- 如果你希望 OpenClaw 在關閉時復原
tailscale serve或tailscale funnel設定,請設定gateway.tailscale.resetOnExit。 gateway.bind: "tailnet"是直接 Tailnet 繫結(無 HTTPS、無 Serve/Funnel)。gateway.bind: "auto"偏好回送位址;如果你想要僅限 Tailnet,請使用tailnet。- Serve/Funnel 只會暴露 Gateway 控制 UI + WS。節點會透過 相同的 Gateway WS 端點連線,因此 Serve 可用於節點存取。
瀏覽器控制(遠端 Gateway + 本機瀏覽器)
如果你在一台機器上執行 Gateway,但想驅動另一台機器上的瀏覽器, 請在瀏覽器所在機器上執行節點主機,並讓兩者保持在同一個 tailnet。 Gateway 會將瀏覽器動作代理至該節點;不需要另外的控制伺服器或 Serve URL。 避免將 Funnel 用於瀏覽器控制;請將節點配對視為操作者存取。Tailscale 先決條件 + 限制
- Serve 需要為你的 tailnet 啟用 HTTPS;若缺少此設定,CLI 會提示。
- Serve 會注入 Tailscale 身分標頭;Funnel 不會。
- Funnel 需要 Tailscale v1.38.3+、MagicDNS、已啟用 HTTPS,以及 funnel 節點屬性。
- Funnel 只支援透過 TLS 使用連接埠
443、8443和10000。 - macOS 上的 Funnel 需要開放原始碼的 Tailscale app 變體。
了解更多
- Tailscale Serve 概覽:https://tailscale.com/kb/1312/serve
tailscale serve指令:https://tailscale.com/kb/1242/tailscale-serve- Tailscale Funnel 概覽:https://tailscale.com/kb/1223/tailscale-funnel
tailscale funnel指令:https://tailscale.com/kb/1311/tailscale-funnel