OpenClaw访问disconnected1008解决

disconnected (1008): control ui requires HTTPS or localhost (secure context)

使用 HTTPS 访问

这是最可靠、功能最完整的方式。

  1. 配置 OpenClaw 网关启用 TLS

    修改 ~/.openclaw/openclaw.json配置文件,在 gateway部分添加 tls配置项。

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    
    {
      "gateway": {
        "mode": "local",
        "bind": "lan",
        "port": 18789,
        "auth": {
          "mode": "token",
          "token": "your-secure-token-here"
        },
        "tls": {
          "enabled": true,
          "certFile": "/path/to/your/cert.pem",
          "keyFile": "/path/to/your/key.pem"
        }
      }
    }
    • certFile​ 和 keyFile:需要指向您的 TLS 证书和私钥文件。对于内部测试,可以生成自签名证书。
  2. 生成自签名证书(测试环境)

    1
    2
    
    # 使用 OpenSSL 生成
    openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj "/CN=your-server-ip-or-name"

    然后将生成的 cert.pemkey.pem路径填入上述配置。

1
2
chmod 644 /home/ah/cert/cert.pem
chmod 600 /home/ah/cert/key.pem
  1. 重启网关并访问

    1
    
    openclaw gateway restart

    之后,通过 **https://<IP>:18789**​ 访问(浏览器会提示证书不安全,点击“继续访问”即可)。

错误 pairing required 解决授权

在 OpenClaw 的安全机制中,除了输入 Token 验证身份外,首次从新设备访问时,还需要在服务器端手动批准该设备的连接请求。

解决方法

请按照以下步骤在部署 OpenClaw 的服务器上操作:

1. 查看待授权设备列表

在服务器终端执行以下命令,查看当前有哪些设备正在请求连接:

1
openclaw devices list

你会看到类似下面的输出,其中包含设备的 ID 和状态(pending表示等待批准):

1
2
Pending (1)
│ Request                              │ Device                             

2. 批准设备连接

找到状态为 pending的设备,复制其 Request,然后执行批准命令:

1
openclaw devices approve [设备ID]

例如:

1
openclaw devices approve 12345678-1234-1234-1234-123456789012

3. 刷新页面

批准成功后,回到浏览器刷新 OpenClaw 的控制台页面,即可正常连接。

后续访问

一旦设备被批准,下次再访问时通常无需重复此操作(除非清除了浏览器数据或更换了设备)。

原文链接: https://www.17you.com/programming/openclaw%E8%AE%BF%E9%97%AEdisconnected1008%E8%A7%A3%E5%86%B3/ 已复制!
编程和技术

寻找技术支持帮助和技术合伙人一起搞事。

请点击联系我


相关内容