-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Web socket fails to connect through Apache #4723
Comments
Same issue here. Using apache2 with reverse proxy. Only occur with 4.0.1, code-server 3.12.0 works fine for me. |
@code-asher any ideas? |
If the exact same config works with 3.12 that does seem like it could be
an issue with 4.0 but I have no idea how; so far all the 1006 errors I
have seen have been caused by misconfiguration.
I am not very familiar with Apache but maybe this comment has a clue:
#2104 (comment)
|
Same issue here using apache2 with reverse proxy |
Ditto. 3.12.0 works fine. 4.0.1 returns 1006. |
Same issue. |
Same issue, 3.12.0 works fine and 4.0.1 fails with this error. I'm using apache2 as a reverse proxy. Trying to access the service directly without the proxy seems to work |
Sounds like we need to spin up Apache and try to reproduce. |
I found a fix on nginx #4763 not sure if there’s an Apache analog for those settings |
I'm guessing that line from release log "Web socket compression has been made the default (when supported). This means |
Me neither.
I cannot find any documentation on said flag, how does it work ? |
There is no way to disable compression support. It is only used if the
browser tells the server that it supports compression.
I am not sure issues with compression could cause a 1006 but you could
could try stripping `permessage-deflate` from the
`Sec-WebSocket-Extensions` header to see if that does anything (this
header is how the browser informs the server it supports compression)
|
Confirming I was able to reproduce:
Then to confirm it is a 4.0.1 issue I killed code-server with
|
I'm also seeing this bug, with NGINX (using nginx proxy manager). I'm currently trying to fix with #4763 but I'm not having any luck. Latest docker version of code-server. |
So, will there be a way to disable compression ? |
Update! The problem was resolved when I tried it from an outside network. So it may have something to do with local routing / proxying differences. Unsure if this is directly related, but my websocket 1006 has been resolved. If I'm local and want to test through the domain I have it on, I'll have to figure out something else. Websocket 1006 error occurred under these conditions.
|
I'm hosting |
same here. Reverse Proxy with apache. 3.X Versions running fine |
Thanks for the comments all! We've recognized this is affecting a lot of people. Instead of commenting, please give the initial issue description a "thumbs-up". Thanks! |
FYI: I also see some content security policy complaints in console log. There are also some 1006 errors, that are resolved in newer versions microsoft/vscode-remote-release#6031 |
I am having the same issue with |
Yes, same here. Was hoping 4.2.0 would fix the issue but alas. Is there no workaround at all? My Code Server in Home Assistant has been unusable for many weeks now :( |
I have 35 enabled apache configurations and am not going to migrate to nginx for this. However, I am stuck to version 3.x until this bug is solved. |
For those affected, what version of Apache are you running? I was able to resolve the issue by updating apache2 to I was experiencing websocket 1006 errors on Apache's mod_proxy_wstunnel documentation mention this:
The grammar is a bit off, but I just assumed Apache was handling the websocket proxy incorrectly and I updated apache. Hope this helps! |
Thanks @leuit, upgrading to Apache/2.4.53 solved the issue |
Thank you @leuit. Upgrading apache2 to 2.4.53 solved the issue for me as well. |
Closing this since the issue seems fixed |
@leuit Thanks! |
I am running
|
@KaKi87 I had to add this repository, and then reinstall apache to upgrade beyond 2.4.41
|
I am running Debian (10), not Ubuntu. |
I successfully upgraded both |
I am using Apache2 version 2.4.53 and cannot use the workaround from @leuit , as disabling |
You don't need to disable that. Once upgraded, it just works. |
@KaKi87 Well, it isn't working for me, and neither is v3.12. I am however, running code-server on a separate machine than the apache server and just trying to forward the site. This is the current config I'm using:
And on the other machine I'm using |
Are you receiving the same error as OP? Is it not upgrading the websocket connection properly? You say you're running code-server on a separate machine from apache; can you directly access code-server via the port it's listening on? Depending on the error you're receiving, I think it may just be a communication issue. If you are indeed receiving the error on the websocket upgrade and can access the frontend webpage of code-server; you'll simply just need to upgrade apache2 as the version does not handle websocket upgrades according to RFC 7230 |
I am receiving the same 1006 error as op, however I don't know how to tell if the websocket is being upgraded properly. I can access code-server from http://192.168.50.60:8081 in my browser and everything works fine. I just followed instructions and upgraded my server to Apache2 version 2.4.53, but it still isn't working. Edit: When I run code-server with Edit 2: I now have it working by using the rewriting rules above instead of using my configuration for proxy passing and reverse proxy passing. |
@ihowell Wonderful! I was going to suggest changing the apache config next; glad you got it resolved! |
Here's my working config using
I always try to make those as light as possible. |
Upgrade Apache2 to 2.4.52 also solved the issue for me without change anythingelse in apache configuration. |
Hi @ihowell can you please share your solution? I have your same issue running last Apache version (2.4.6) |
Upgrading apache2 worked for me. |
This issue has not been resolved in version 4. |
try nginx config as follows: location ~ ${your frontend url pattern} {
# add it if your url is dynamic
resolver {your DNS server}
# trick here, consult here for Nginx official doc
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
# trick here, if absent, the server will block the websocket request if the origin is NOT equal to the host
proxy_set_header Origin http://${your backend host}/;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Accept-Encoding gzip;
proxy_cookie_domain ${your backend host} ${your frontend host};
proxy_pass ${your backend url pattern};
} config above working for me. my scene:
|
OS/Web Information
code-server --version
: 4.0.1Logs
code-server --log debug
[2022-01-11T03:38:43.612Z] info code-server 4.0.1 735c6da
[2022-01-11T03:38:43.613Z] info Using user-data-dir ~/.local/share/code-server
[2022-01-11T03:38:43.628Z] info Using config file ~/.config/code-server/config.yaml
[2022-01-11T03:38:43.628Z] info HTTP server listening on http://0.0.0.0:8080/
[2022-01-11T03:38:43.628Z] info - Authentication is enabled
[2022-01-11T03:38:43.628Z] info - Using password from ~/.config/code-server/config.yaml
[2022-01-11T03:38:43.628Z] info - Not serving HTTPS
[22:38:51] Extension host agent started.
[22:38:51] [Theme Service] Scanning for theme extension...
[22:38:51] [Theme Service] theme-abyss
[22:38:51] [Theme Service] theme-defaults
[22:38:51] [Theme Service] theme-kimbie-dark
[22:38:51] [Theme Service] theme-monokai
[22:38:51] [Theme Service] theme-monokai-dimmed
[22:38:51] [Theme Service] theme-quietlight
[22:38:51] [Theme Service] theme-red
[22:38:51] [Theme Service] theme-solarized-dark
[22:38:51] [Theme Service] theme-solarized-light
[22:38:51] [Theme Service] theme-tomorrow-night-blue
[22:38:51] [Theme Service] Attempting to find user's active theme: Default Dark+
[2022-01-11T03:38:54.949Z] debug got latest version {"latest":"4.0.1"}
[2022-01-11T03:38:54.949Z] debug comparing versions {"current":"4.0.1","latest":"4.0.1"}
[2022-01-11T03:39:51.007Z] debug 0 active connections
Screenshot
Notes
I currently only experience this error on code-server 4.0.1. code-server 3.12.0 works without issue.
I am currently using apache2 with a reverse proxy. The current config for the apache2 virtual host is below:
<Location "/">
ProxyPass http://127.0.0.1:8080/
ProxyPassReverse http://127.0.0.1:8080/
ProxyPassReverse /
RewriteEngine on
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteCond %{HTTP:Connection} upgrade [NC]
RewriteRule ^/?(.*) "ws://127.0.0.1:8080/" [P,L]
I also made sure all the websockets modules are loaded in apache2 and working without problems. No errors occur on the Apache web server. Any suggestions on how to get this working with Apache2?
This issue can be reproduced in VS Code: No
The text was updated successfully, but these errors were encountered: