Skip to content

[Bug]: The workbench failed to connect to the server #6014

Closed as not planned
Closed as not planned

Description

@JonSmall

Is there an existing issue for this?

  • I have searched the existing issues

OS/Web Information

  • Web Browser: Chrome
  • Local OS: Windows
  • Remote OS: Docker
  • Remote Architecture: Docker Image
  • code-server --version: 4.9.1

Steps to Reproduce

  1. docker run -d -it --name code-server -p 8080:8080
    -v "/home/docker/code-server/config:/home/coder/.config"
    -v "/home/docker/code-server:/home/coder/project"
    -u "$(id -u):$(id -g)"
    -e "DOCKER_USER=$USER"
    codercom/code-server:4.9.1

  2. open chrome http://${ip}:8080

  3. find the config.yaml, and enter the password

  4. it shows
    The workbench failed to connect to the server (Error: WebSocket close with status code 1006)
    and again and agin reload, i can`t use it

Expected

Not show
The workbench failed to connect to the server (Error: WebSocket close with status code 1006)
And use the IDE

Actual

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

Logs

File not found: /usr/lib/code-server/lib/vscode/extensions/git-base/dist/browser/extension.js
File not found: /usr/lib/code-server/lib/vscode/extensions/emmet/dist/browser/emmetBrowserMain.js
File not found: /usr/lib/code-server/lib/vscode/extensions/merge-conflict/dist/browser/mergeConflictMain.js

Screenshot/Video

888888

Does this issue happen in VS Code or GitHub Codespaces?

  • I cannot reproduce this in VS Code.
  • I cannot reproduce this in GitHub Codespaces.

Are you accessing code-server over HTTPS?

  • I am using HTTPS.

Notes

No response

Activity

  1. added
    bugSomething isn't working
    triageThis issue needs to be triaged by a maintainer
    on Feb 11, 2023
  2. code-asher commented on Feb 13, 2023

    @code-asher
    Member
  3. ManuXD32 commented on Mar 29, 2023

    @ManuXD32

    Does the IP you are connecting to go directly to the Docker container or is there some kind of proxy in between? Usually 1006 means something is dropping the web socket. Is this Docker Desktop on Windows or over WSL?

    I am having the same error, mine is through an apache reverse proxy. I have tried the solutions of other threads, but they just don't work.
    Any idea?

  4. code-asher commented on Mar 30, 2023

    @code-asher
    Member
  5. ManuXD32 commented on Apr 5, 2023

    @ManuXD32

    Do you see any warnings or errors in code-server's logs? If you are using 4.10.1 or later also make sure that the host header matches the origin header that the browser is sending otherwise the socket will be blocked for security reasons.

    It turned out to be a missconfiguration under the .conf file. GPT4 solved It heh. Thank you so much, anyway.

  6. freaker2112 commented on Apr 11, 2023

    @freaker2112

    Do you see any warnings or errors in code-server's logs? If you are using 4.10.1 or later also make sure that the host header matches the origin header that the browser is sending otherwise the socket will be blocked for security reasons.

    It turned out to be a missconfiguration under the .conf file. GPT4 solved It heh. Thank you so much, anyway.

    what fixed it? I'm having this same issue

  7. ManuXD32 commented on Apr 20, 2023

    @ManuXD32

    Do you see any warnings or errors in code-server's logs? If you are using 4.10.1 or later also make sure that the host header matches the origin header that the browser is sending otherwise the socket will be blocked for security reasons.

    It turned out to be a missconfiguration under the .conf file. GPT4 solved It heh. Thank you so much, anyway.

    what fixed it? I'm having this same issue

    Try changing your .conf file to look like this: Ps: remember to end the conf file with "</VirtualHost>" for some reason my comment looks weird,

    <VirtualHost *:80>
    ServerName codeYOUR_DOMAIN
    ServerAdmin USER@YOUR_DOMAIN
    ProxyPreserveHost On
    ProxyRequests Off
    AllowEncodedSlashes NoDecode

    <Location />
        ProxyPass http://localhost:YOUR_PORT/ nocanon
        ProxyPassReverse http://localhost:YOUR_PORT/
        ProxyPassReverseCookieDomain localhost codeYOUR_DOMAIN
        ProxyPassReverseCookiePath / /
    </Location>
    
    RewriteEngine On
    RewriteCond %{HTTP:Upgrade} websocket [NC]
    RewriteCond %{HTTP:Connection} upgrade [NC]
    RewriteRule ^/?(.*) "ws://localhost:YOUR_PORT/$1" [P,L]
    
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    

    </VirtualHost>

  8. code-asher commented on Jul 12, 2024

    @code-asher
    Member

    Closing as stale but feel free to comment if you come back to this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageThis issue needs to be triaged by a maintainer

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions