Skip to content

Incorrect root url detection for WebSocket with any non-root url path #101

Closed

Description

@ICEFIR
  • code-server version: 1.0.0
  • OS Version: Debian 9, With docker deployment

Steps to Reproduce

  1. Setup Nginx reverse proxy to a different path - i.e. to something.something.com/vscode/
  2. Login works fine, but upon vscode page, it's just a blank page. Client browser console shows its trying to connect to wss://something.somthing.com/, without the correct root-relative path (something.something.com/vscode/), which.... obvious will not work.

Also, I did not find any documentation (or config in general) related to this type of deployment... guess that probably can be improved a bit?

Activity

  1. idoprz commented on Mar 8, 2019

    @idoprz

    I can also see that getting the webpack_hmr is failing because it looks for it in the host root.

  2. MrDetonia commented on Mar 8, 2019

    @MrDetonia

    I'm having the exact same problem. Nginx is set up to run a reverse proxy under a /code/ location, headers set to upgrade the connection for websockets, but I see the page trying to make websocket connections, and GET __webpack_hmr from my root url.

    Outside of using e.g. a subdomain and an entirely new Nginx site, I don't see a feasible solution for this; and I imagine having VSCode exist as a sub-directory may be a common setup.

  3. kylecarbs commented on Mar 8, 2019

    @kylecarbs
    Member

    Ah I know the issue.

    Updating https://github.com/codercom/code-server/blob/master/packages/ide/src/fill/client.ts#L95 to contain the browser URL should fix this.

  4. MrDetonia commented on Mar 13, 2019

    @MrDetonia

    This seems to have been fixed by #149

    Have built a fresh image from upstream and tested the same setup that was previously broken - all working.

  5. si458 commented on Mar 14, 2019

    @si458

    i have pulled the latest image from https://hub.docker.com/r/codercom/code-server
    (March 13, 2019 07:36 PM) and im still getting the 404 error ?

    Firefox can't establish a connection to the server at https://192.168.168.77:32770/__webpack_hmr.

    sample docker-compose file

    version: '2'
    services:
      codeserver:
        image: codercom/code-server:latest
        ports:
          - 8443
        volumes:
          - codeserver:/root/project
    volumes:
      codeserver:
        driver: local
    
  6. betatim commented on Mar 14, 2019

    @betatim
  7. si458 commented on Mar 15, 2019

    @si458

    i have pulled the latest image again this morning from https://hub.docker.com/r/codercom/code-server (March 15, 2019 05:19 AM) and im still getting the 404 error ?
    Firefox can't establish a connection to the server at https://192.168.168.77:32770/__webpack_hmr.

  8. MrDetonia commented on Mar 15, 2019

    @MrDetonia

    @si458 Odd, as that fix seems to be included in the latest release:
    https://github.com/codercom/code-server/blob/2f27b5df8cc37d047ff93bf842c856c97ad74170/packages/ide/src/fill/client.ts#L96

    Are you sure it's the same issue / able to post your nginx config?

  9. si458 commented on Mar 15, 2019

    @si458

    @MrDetonia i dont use nginx?
    i only use a docker-compose file, nothing special

    version: '2'
    services:
      codeserver:
        image: codercom/code-server:latest
        ports:
          - 8443
        volumes:
          - codeserver:/root/project
        command: --allow-http --no-auth
    volumes:
      codeserver:
        driver: local
    
  10. MrDetonia commented on Mar 15, 2019

    @MrDetonia

    @si458 as I understand it, this issue was specific to using a reverse proxy with nginx (see OP). You may be seeing some other issue that is unrelated.

  11. si458 commented on Mar 15, 2019

    @si458

    @MrDetonia your are correct, sorry

    ill tag onto the other issue thats been closed but it needs re-opening as its still an issue
    #141

  12. kylecarbs commented on Apr 24, 2019

    @kylecarbs
    Member

    I believe this is fixed. cc: @code-asher

  13. code-asher commented on Apr 25, 2019

    @code-asher
    Member

    Yup, the websocket uses the same URL that serves code-server now.

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 working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions