Web(Gateway)
Gateway は Gateway WebSocket と同じポートから小さなブラウザ Control UI(Vite + Lit)を配信します。
- デフォルト:
http://<host>:18789/ - プレフィックスの変更:
gateway.controlUi.basePathを設定(例:/openclaw)
機能の詳細は Control UI にあります。 このページではバインドモード、セキュリティ、Web 向けサーフェスについて説明します。
Webhook
hooks.enabled=true の場合、Gateway は同じ HTTP サーバー上に小さな Webhook エンドポイントも公開します。
認証とペイロードについては Gateway 設定 の hooks を参照してください。
設定(デフォルトで有効)
Control UI はアセットが存在する場合(dist/control-ui)、デフォルトで有効です。
設定で制御できます:
{
gateway: {
controlUi: { enabled: true, basePath: "/openclaw" }, // basePath は任意
},
}
Tailscale アクセス
統合 Serve(推奨)
Gateway をループバックのままにし、Tailscale Serve でプロキシします。
{
gateway: {
bind: "loopback",
tailscale: { mode: "serve" },
},
}
Gateway を起動:
openclaw gateway
アクセス:
https://<magicdns>/(または設定したgateway.controlUi.basePath)
Tailnet バインド + トークン
{
gateway: {
bind: "tailnet",
controlUi: { enabled: true },
auth: { mode: "token", token: "your-token" },
},
}
Gateway を起動(非ループバックバインドにはトークンが必要):
openclaw gateway
アクセス:
http://<tailscale-ip>:18789/(または設定したgateway.controlUi.basePath)
パブリックインターネット(Funnel)
{
gateway: {
bind: "loopback",
tailscale: { mode: "funnel" },
auth: { mode: "password" }, // または OPENCLAW_GATEWAY_PASSWORD
},
}
セキュリティに関する注意事項
- Gateway 認証はデフォルトで必須(トークン/パスワードまたは Tailscale ID ヘッダー)。
- 非ループバックバインドでも共有トークン/パスワード(
gateway.authまたは環境変数)が必要です。 - ウィザードはデフォルトで Gateway トークンを生成します(ループバックでも)。
- UI は
connect.params.auth.tokenまたはconnect.params.auth.passwordを送信します。 - 非ループバックの Control UI デプロイメントでは、
gateway.controlUi.allowedOriginsを明示的に設定してください(完全なオリジン)。設定がない場合、Gateway の起動がデフォルトで拒否されます。 gateway.controlUi.dangerouslyAllowHostHeaderOriginFallback=trueは Host ヘッダーオリジンフォールバックモードを有効にしますが、危険なセキュリティの低下です。- Serve を使用する場合、
gateway.auth.allowTailscaleがtrueのとき Tailscale ID ヘッダーで Control UI/WebSocket 認証が可能です(トークン/パスワード不要)。 HTTP API エンドポイントは引き続きトークン/パスワードが必要です。 明示的な認証情報を要求するにはgateway.auth.allowTailscale: falseに設定してください。 Tailscale と セキュリティ を参照。このトークンレスフローは Gateway ホストが信頼されていることを前提とします。 gateway.tailscale.mode: "funnel"にはgateway.auth.mode: "password"(共有パスワード)が必要です。
UI のビルド
Gateway は dist/control-ui から静的ファイルを配信します。以下でビルドします。
pnpm ui:build # 初回実行時に UI の依存関係を自動インストール