openclaw安装后,默认是不允许局域网访问的,只能本机127.0.0.1访问,因为openclaw默认监听的是127.0.0.1:18789,仅本机可以访问。想要实现局域访问,可以进行一下设置:1、(可选)更新版本到最新版本
2、允许局域网访问
openclaw config set gateway.bind lan
3、允许非安全认证,解决origin跨域的关键
openclaw config set gateway.controlUi.allowInsecureAuth trueopenclaw config set gateway.controlUi.dangerouslyDisableDeviceAuth true
4、查看查看本机的IP地址,配置允许的来源,解决跨域的问题
openclaw config set 'gateway.controlUi.allowedOrigins' '["http://192.168.0.62:18789"]'
注意,如果命令执行,失败,找到openclaw.json文件,修改配置,注意是增加 "http://192.168.0.62:18789",别忘了逗号 "gateway": { "port": 18789, "mode": "local", "bind": "lan", "controlUi": { "allowedOrigins": [ "http://localhost:18789", "http://127.0.0.1:18789", "http://192.168.0.62:18789" ],
5、重启网关
6、使用局域网的电脑,访问http://192.168.0.62:18789。
7、打开概览,输入网关令牌,点击连接即可。
8、网关令牌的获取方式如下: