AI创想
标题:
解决OpenClaw只能本地访问的问题
[打印本页]
作者:
米落枫
时间:
昨天 23:17
标题:
解决OpenClaw只能本地访问的问题
作者:CSDN博客
OpenClaw 的默认配置是只能在本机上访问,也就是说只能通过 “localhost” 或 “127.0.0.1” 来访问控制台。需要解决该问题有以下四种方式,大家可以根据自己的实际情况来选择。
快速部署安装
方式一: 详见安装文档
方式二:推荐方式
方式一:控制台修改
该方式的前提是你能通过浏览器访问到控制台了才行,我这里都是默认配置。
注意事项:
我这里默认配置是通过 “127.0.0.1” 可以正常访问渲染,可能有的人是 “localhost” 访问是正常的。这个大家可以不用管,是配置的差异问题,不影响操作。
步骤一:访问控制台
打开地址:http://127.0.0.1:18789/config
(, 下载次数: 0)
上传
点击文件名下载附件
步骤二:修改 Setup Wizard 的 Mode
将默认的 local 改为 remote
(, 下载次数: 0)
上传
点击文件名下载附件
步骤三:修改 Gateway 的 Bind
将默认的 loopback 改为 lan
(, 下载次数: 0)
上传
点击文件名下载附件
步骤四:重启 OpenClaw 服务
(, 下载次数: 0)
上传
点击文件名下载附件
发现问题:
这里可能很多人访问后会发现一个问题,页面显示错误:
disconnected (1008): control ui requires HTTPS or localhost (secure context)
复制代码
(, 下载次数: 0)
上传
点击文件名下载附件
解决办法:
修改配置文件 openclaw.json 在配置文件中新增以下内容:
修改前:
"gateway": {
"port": 18789,
"mode": "local",
"bind": "lan",
"auth": {
"mode": "token",
"token": "6feca87ceb8134d44ea3148b5fb41d1f40fcc9ed0e7920a9"
},
"tailscale": {
"mode": "off",
"resetOnExit": false
}
},
复制代码
修改后:
"gateway": {
"port": 18789,
"mode": "local",
"bind": "lan",
// 新增配置
"controlUi": {
"allowInsecureAuth": true
},
"auth": {
"mode": "token",
"token": "6feca87ceb8134d44ea3148b5fb41d1f40fcc9ed0e7920a9"
},
"tailscale": {
"mode": "off",
"resetOnExit": false
}
},
复制代码
方式二:通过命令行修改
# 步骤一:
clawdbot config set gateway.bind lan
# 步骤二
clawdbot config set gateway.controlUi.allowInsecureAuth true
# 步骤三
clawdbot gateway restart
# 备注命令说明
# 指定端口
openclaw gateway --port 19000
# 绑定模式
openclaw gateway --bind loopback # 仅本机访问(默认,最安全)
openclaw gateway --bind lan # 局域网可访问
openclaw gateway --bind tailnet # Tailscale 网络
# 通过 Tailscale 暴露服务
openclaw gateway --tailscale serve # 内网暴露
openclaw gateway --tailscale funnel # 公网暴露(需要 Tailscale 账户)
复制代码
方式三:修改配置文件
Windows路径:C:\Users\user\.openclawLinux路径:~/.openclaw/openclaw.json
路径查看方式,详见下图:
(, 下载次数: 0)
上传
点击文件名下载附件
找到目录:
(, 下载次数: 0)
上传
点击文件名下载附件
我的配置文件示例如下:
{
"meta": {
"lastTouchedVersion": "2026.2.2",
"lastTouchedAt": "2026-02-27T09:17:47.844Z"
},
"wizard": {
"lastRunAt": "2026-02-27T08:55:43.077Z",
"lastRunVersion": "2026.2.2",
"lastRunCommand": "onboard",
"lastRunMode": "remote"
},
"auth": {
"profiles": {
"deepseek:default": {
"provider": "deepseek",
"mode": "api_key"
}
}
},
"models": {
"mode": "merge",
"providers": {
"deepseek": {
"baseUrl": "https://api.deepseek.com",
"api": "openai-completions",
"models": [
{
"id": "deepseek-chat",
"name": "DeepSeek Chat",
"reasoning": false,
"input": [
"text"
],
"cost": {
"input": 0.14,
"output": 0.28,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 64000,
"maxTokens": 4096
},
{
"id": "deepseek-coder",
"name": "DeepSeek Coder",
"reasoning": false,
"input": [
"text"
],
"cost": {
"input": 0.14,
"output": 0.28,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 64000,
"maxTokens": 4096
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "deepseek/deepseek-chat"
},
"models": {
"deepseek/deepseek-chat": {
"alias": "DeepSeek Chat"
}
},
"workspace": "C:\\Users\\user\\.openclaw\\workspace",
"compaction": {
"mode": "safeguard"
},
"maxConcurrent": 4,
"subagents": {
"maxConcurrent": 8
}
}
},
"messages": {
"ackReactionScope": "group-mentions"
},
"commands": {
"native": "auto",
"nativeSkills": "auto"
},
"gateway": {
"port": 18789,
"mode": "local",
"bind": "lan",
"controlUi": {
"allowInsecureAuth": true
},
"auth": {
"mode": "token",
"token": "6feca87ceb8134d44ea3148b5fb41d1f40fcc9ed0e7920a9"
},
"tailscale": {
"mode": "off",
"resetOnExit": false
}
},
"skills": {
"install": {
"nodeManager": "pnpm"
}
}
}
复制代码
原文地址:https://blog.csdn.net/qq_37165235/article/details/158468009
欢迎光临 AI创想 (http://www.llms-ai.com/)
Powered by Discuz! X3.4