0

我正在尝试在云平台上安装 code-server 3.6.2。我已经尝试过 AWS 和 digitalocean 机器,但在这两个系统中,我都可以打开代码服务器,但它会给出错误“WebSocket close with status code 1006”。

我已按照https://www.digitalocean.com/community/tutorials/how-to-set-up-the-code-server-cloud-ide-platform-on-ubuntu-20-04中的程序进行操作

4

2 回答 2

0

code-server 使用 websocket 连接。你使用 HTTPS 吗?
如果是这样,你应该使用 wss 来转发 ws.like 这样的:

// forward websocket (wss -> ws)
httpsServer.on('upgrade', function (req, socket, head) {
  proxy.ws(req, socket, head, {
    target: 'ws://...',
    ws: true
  })
})

于 2021-01-20T08:31:04.487 回答
0

通常,当您在本地使用代码服务器时会发生此错误和其他错误要解决它,您可以使用 --link 参数,该参数为您提供带有临时 https 的 url,或者您也可以使用 ngrok

 //Option 1
    code-server --host 127.0.0.1 --bind-addr 0.0.0.0:9000 --auth password --link


 //Option 2
    code-server --host 127.0.0.1 --bind-addr 0.0.0.0:9000 --auth password 
    ngrok http 9000
于 2021-05-08T13:56:32.040 回答