-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The workbench failed to connect to the server (Error: WebSocket close with status code 1006) #4443
Comments
i got this too. i ran it in docker. |
proxy_set_header Upgrade $http_upgrade; |
Thanks, that seemed to work. |
Any idea which version broke this? I can't get it to work with Nginx-Proxy-Manager so I'll just downgrade until code-server gets it's sh*t together. |
cc @code-asher |
Those headers enable proxying websockets so it is not a code-server issue as far as I can tell. |
If anyone is looking for a solution for ingress-nginx on Kubernetes like I was, add this annotation to your ingress nginx.org/websocket-services: "code-server" Replace code-server with whatever your code-server service name is. |
A little late now, but does anyone have a working configuration for Apache2? |
Hey looking for the same thing, having issues proxying code server in apache2 |
@tinuh @ZandercraftGames I hope this works for you! |
A little late now, but does anyone have a working configuration for caddy2? |
Thank you very much. It's very useful to me. |
for kubernetes, I had to add BOTH suggestions from Link1 and annotations as follows. PS: the {{ .Values.user }} etc, are dynamic values from values.yml of helm chart which you need to replace
Entire example below using helm chart
|
Did you ever get a resolution to this? |
If you are facing wss:// websocket 1006 error on kubernetes with NGINX Ingress Controller, you can try to add timeout annotations to service ingress.
|
I don't want to wake up an old issue. But I've had it working, and suddenly this error came. |
Just to confirm, is |
@code-asher thanks. Adding |
code-server version: 4.12.0
|
Edit: Or |
I just added these headers:
Should I try to delete the binhex image and use yours? Cause it's not working for me. |
I am not familiar with the binhex image but if you add |
Please. Please don't forget to restart ngnix after changing the configuration. |
Fix for Nginx-Proxy-Manager "Advanced" → Custom Nginx Configuration: location / {
# proxy_ssl_verify off;
proxy_set_header Host $host;
proxy_set_header Accept-Encoding gzip;
proxy_set_header X-Forwarded-Host $host;
#proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_http_version 1.1;
# Proxy!
include conf.d/include/proxy.conf;
} |
this one works for me. Thanks! |
works, Thanks! |
update nginx config to avoid wss error when expose code-server using a custom domain and a custom port via nginx. see also: [issue of code-server](coder#4443) [different between `$host` and `$http_host`](https://stackoverflow.com/a/76875724)
I re-produced too, caused by the slight differences in nginx config template from https://github.com/cdr/code-server/blob/main/docs/guide.md#using-lets-encrypt-with-nginx , and issued a pull-request: #6471 |
update nginx config to avoid wss error when expose code-server using a custom domain and a custom port via nginx. see also: [issue of code-server](#4443) [different between `$host` and `$http_host`](https://stackoverflow.com/a/76875724)
for me, below is work: (docker run & nginx proxy outside the docker container)
|
This config file worked for me. Solved the websock error. Thanks a lot! |
Hi, I found an issue where if I set the port to 443:443 in the docker compose of Nginx-Proxy-Manager ,reverse proxies are good. I was able to use code-server in the docker . But If I set a different port mapping 443 in the docker compose of Nginx-Proxy-Manager (such as 9091:443), I can't use linuxserver/code-server . There is an error, "The workbench failed to connect to the server (Error: WebSocket close with status code 1006)" . Because my port 443 is forbidden, I want to use a different port. |
@octopus2181 Could you open a new issue with a Docker compose I can use to reproduce the issue? I will look into it. |
For you referece, with code-server version 4.20.1, my working nginx configuration is:
|
Yes, you are right ! Setting proxy_set_header X-Forwarded-Host $http_host , the port 9091 can connect to the code-server . |
Since nearly every solution on this issue refers to non-standard networking configurations without elaborating on what they're supposed to indicate, here's the configuration that worked for my specific local environment (NGINX Proxy Manager + lscr.io's code-server image in separate docker stacks sharing the same 'proxy' bridge network):
This configuration uses the default ports that both code-server and NGINX Proxy Manager use out-of-the-box, at least while using lscr.io's code-server image- but it should still work either way. If you run into any issues after this point, ensure you haven't incorrectly modified any of code-server's proxy-related environment variables (i.e, CS_DISABLE_PROXY or PROXY_DOMAIN), and ensure that you correctly configured your domain's DNS settings through your DNS provider if applicable (i.e, an A record pointing *.yourdomain.com to your server's IP or tunnel configuration). Here's what my final docker-compose.yml file looked like (environment variables redacted):
Full disclaimer that I have no idea if I'm following the best practices here, I'm just posting what worked for my very specific configuration. Feel free to correct me if there's a better way to go about any of this. |
@code-asher 's answer works for me, and a faster way:
|
This configuration works for me. |
This works for me. I've tried lots of configuration, the key line is |
@wangyizhi1 Awesome, this works! |
update nginx config to avoid wss error when expose code-server using a custom domain and a custom port via nginx. see also: [issue of code-server](coder#4443) [different between `$host` and `$http_host`](https://stackoverflow.com/a/76875724)
For those that may be needing to proxy through IIS, here is a couple rewrite rules for that. This app uses permessage-deflate which ARR does not support, so the request fails with this 1006 error message <rule name="removepermessagedeflate">
<match url=".*" />
<conditions>
<add input="{HTTP_SEC_WEBSOCKET_EXTENSIONS}" pattern="permessage-deflate(.*)" />
</conditions>
<serverVariables>
<set name="HTTP_SEC_WEBSOCKET_EXTENSIONS" value="{C:1}" />
</serverVariables>
<action type="None" />
</rule>
<rule name="proxy">
<match url=".*" />
<action type="Rewrite" url="http://10.8.0.4:8080/{R:0}" />
</rule> |
OS/Web Information
code-server --version
: 3.12.0Steps to Reproduce
Expected
The server would work normally.
Actual
See error above.
Logs
Logs look normal for the remote server, however browser gives error:
(I replaced my domain with for privacy reasons.)
Screenshot
Notes
This issue can be reproduced in VS Code: No
The text was updated successfully, but these errors were encountered: