The workbench failed to connect to the server (Error: WebSocket close with status code 1006)

Hello I am trying to connect a remote machine to the WEB IDE, but I am getting the following error

I am using an ubuntu vps

Use this configuration in nginx

server {
server_name remote.demo.com;

location / {
  proxy_pass http://localhost:3443;
  proxy_set_header Host $host;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection "upgrade";
  proxy_set_header Accept-Encoding gzip;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_http_version 1.1;
}

}

Also enable Websockets on cloudflare

I followed the steps in this guide:

I’m also getting the same issue. I’ve followed recommended actions in this GitHub thread The workbench failed to connect to the server (Error: WebSocket close with status code 1006) · Issue #4443 · coder/code-server · GitHub but it did not work for me. I tried to overwrite the nginx.conf.template of the remote development image nginx.conf.template · main · GitLab.org / Remote Development / gitlab-rd-web-ide-docker · GitLab, but I still get the issue.

Operating on Ubuntu 22.04. I’ve tested that websockets work fine & domain work fine with a separate test server. This error seems specific to the GitLab remote development image, regarding the proxying of WebSockets by Nginx.