配置监听模式时,建议使用 openclaw config 按照提示进行配置,防止修改~/.openclaw/openclaw.json 文件后运行gateway 相关配置不匹配导致gateway运行时报错,无法正常启动
一、Gateway bind mode 监听 IP 模式说明
控制龙虾后台监听在哪块网卡,决定哪些设备能访问面板
| 选项 | 监听地址 | 访问范围 | 适用场景 |
| Loopback (Local only) | 127.0.0.1 | 仅本机访问,远程 / 局域网无法连接 | 仅本地使用,最高安全 |
| Tailnet (Tailscale IP) | 100.x.x.x | 仅同 Tailscale 组网内设备访问 | 多设备异地远程管理 |
| Auto (Loopback → LAN) | 自适应 | 有 Tailscale 走 100 段,无则监听局域网 | 懒人自动适配 |
| LAN (All interfaces) | 0.0.0.0 | 本机所有网卡,局域网 / 端口映射公网均可访问 | 内网多设备、公网端口映射 |
| Custom IP | 自定义指定 IP | 仅指定单 IP / 网卡访问 | 多网卡精细化隔离 |
二、Tailscale exposure 暴露模式说明
控制 Tailscale 是否将龙虾服务对外发布
| 选项 | 作用 | 访问权限 | 风险 |
| Off | 关闭对外暴露 | 仅同账号 Tailscale 内网设备访问 | 无风险,推荐日常自用 |
| Serve | 内网 HTTPS 域名发布 | 同 Tailnet 账号成员通过xxx.ts.net访问,不开放公网 |
低风险,适合多人内网共享 |
| Funnel | 公网 HTTPS 对外开放 | 全网任意设备无需 Tailscale 即可访问 | 高危,仅临时测试使用 |
三、报错
openclaw gateway run # 运行gateway 并在命令行现实运行的日志
浏览器访问openclaw 的仪表盘:http://xx.xx.xx.xx:18789
报错一:
解决方案:
# 填写你的局域网IP和公网IP openclaw config set gateway.controlUi.allowedOrigins '[ "http://127.0.0.1:18789", "http://xxx.xxx.xxx.xxx:18789", "http://xxx.xxx.xxx.xxx:18789" ]' # 或者(不推荐) openclaw config set gateway.controlUi.allowedOrigins '[*]'
报错二:
前端界面报错:control ui requires device identity (use HTTPS or localhost secure context)
原因:
官方文档明确说明:
gateway.controlUi.allowInsecureAuth仅对127.0.0.1 / localhost本地访问生效,**局域网 IP、公网 IP HTTP 访问完全不生效。- 浏览器强制限制:
http://192.168.x.x/http://公网IP属于非安全上下文,浏览器禁用 WebCrypto 接口,无法生成设备身份密钥,直接抛出control ui requires device identity,这个限制是浏览器底层规则,单纯开 allowInsecureAuth 绕不过。
解决方法:
# 1. 允许HTTP不安全认证 openclaw config set gateway.controlUi.allowInsecureAuth true # 2. 核心:彻底关闭设备身份校验,解决 requires device identity openclaw config set gateway.controlUi.dangerouslyDisableDeviceAuth true # 3. 绕过Host头Origin校验,解决 origin not allowed openclaw config set gateway.controlUi.dangerouslyAllowHostHeaderOriginFallback true # 4. 放行你的内网+公网访问地址(替换成你自己的IP) openclaw config set gateway.controlUi.allowedOrigins '[ "http://127.0.0.1:18789", "http://xxx.xxx.xxx.xxx:18789", "http://xxx.xxx.xxx.xxx:18789" ]' # 5. 网关绑定LAN(0.0.0.0全网卡监听) openclaw config set gateway.bind lan # 6. Tailscale关闭(纯HTTP不需要) openclaw config set gateway.tailscale.mode off # 重启网关全部生效 openclaw gateway restart