Skip to content

[Bug]: Error: WebSocket close with status code 1006 #6644

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

Closed
1 of 6 tasks
octopus2181 opened this issue Feb 1, 2024 · 3 comments
Closed
1 of 6 tasks

[Bug]: Error: WebSocket close with status code 1006 #6644

octopus2181 opened this issue Feb 1, 2024 · 3 comments
Labels
bug Something isn't working triage This issue needs to be triaged by a maintainer

Comments

@octopus2181
Copy link

octopus2181 commented Feb 1, 2024

Is there an existing issue for this?

  • I have searched the existing issues

OS/Web Information

  • Web Browser: Edge
  • Local OS: Win10 docker desktop wsl2
  • Remote OS: Win10 docker desktop wsl2
  • Remote Architecture: x86-64
  • code-server --version: codercom/code-server

Steps to Reproduce

  1. If I set the port to 443:443 in the docker compose of linuxserver/swag ,reverse proxies are good. I was able to use code-server in the docker .
  2. But If I set a different port mapping 443 in the docker compose of linuxserver/swag (such as 9091:443), I can't use code-server .

Expected

Because my port 443 remote access is forbidden, I want to works with a different port (such as 9091 ).

Actual

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

Logs

##code-server.yml
version: "3"
services:
    code-server:
        container_name: code-server
        image: codercom/code-server
        external_links:
          - swag-network
        ports:
          - 8080:8080
        volumes:
          - /d/Docker_hub/code_server/config:/config
        environment:
          - PUID=1000
          - PGID=1000
          - TZ=Asia/Shanghai
          - PASSWORD=*******
          - PROXY_DOMAIN=code-server.example.dynv6.net #optional
          - DEFAULT_WORKSPACE=/config/workspace
        restart: always

##swag.yml
version: "3"
services:
  swag:
    container_name: swag
    image: linuxserver/swag
    cap_add:
      - NET_ADMIN
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Asia/Shanghai
      - URL=example.dynv6.net
      - SUBDOMAINS=wildcard
      - VALIDATION=dns
      - DNSPLUGIN=rfc2136
    volumes:
      - /d/Docker_hub/swag_9091/config:/config
    ports:
      - 9091:443
      - 8081:80 #optional
    restart: unless-stopped
networks:
  swag-network:
    driver: bridge


##/config/nginx/proxy-confs/code-server.subdomain.conf
server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;
    server_name code-server.* "~^[0-9]{1,10}\.linux-code-server\..*$";
    include /config/nginx/ssl.conf;
    client_max_body_size 0;
    location / {
        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        set $upstream_app code-server;
        set $upstream_port 8080;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;
    }
}

Screenshot/Video

No response

Does this issue happen in VS Code or GitHub Codespaces?

  • I tested this in native VS Code.
  • This does not happen in native VS Code.
  • I tested this in GitHub Codespaces.
  • This does not happen in GitHub Codespaces.

Are you accessing code-server over a secure context?

  • I am using a secure context.

Notes

No response

@octopus2181 octopus2181 added bug Something isn't working triage This issue needs to be triaged by a maintainer labels Feb 1, 2024
@code-asher
Copy link
Member

Thank you for the reproduction details! I had trouble using them because it seems Swag is trying to generate real certificates and it does not look like they have an option to generate self-signed certificates?

Could you run code-server again with the LOG_LEVEL=debug environment variable and tell me if you see any messages like "blocking request"?

@code-asher
Copy link
Member

Looks like /config/nginx/proxy.conf contains these lines:

proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;

I think you already tried setting Host, right? code-server will prefer X-Forwarded-Host over Host so it might work to override it:

proxy_set_header X-Forwarded-Host $http_host;

We really need to fix #6166

@octopus2181
Copy link
Author

Oh , yes ! I am setting proxy_set_header X-Forwarded-Host $http_host ,it woks . The port 9091 can connect to the code-server .
Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage This issue needs to be triaged by a maintainer
Projects
None yet
Development

No branches or pull requests

2 participants