microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.28k stars 28.89k forks source link

Server-base-path not applied to WSS connections #208998

Open okalldal opened 6 months ago

okalldal commented 6 months ago

Does this issue occur when all extensions are disabled?: Yes

Steps to Reproduce:

  1. code-insiders serve-web --host 0.0.0.0 --port 8080 --server-base-path=/ides/foo
  2. open a local browser and enable developer tools
  3. access the server on http://localhost:8080/ides/foo
  4. Inspect network connections and check WSS connections
  5. These do not have the base server prefix

As a consequence, the following does not work:

Through nginx proxy, for example, when requesting https://foo.example.com/ides/foo, a wss error occurs. By checking the browser console, you can see the wss error, and the request address is wss://foo.example.com/oss-xxxx, which does not include the server base path URI path.

An example configuration for nginx proxy is as follows:

upstream vscode { server 192.168.0.100:8888; } server { servername foo.example.com; location / { proxy_pass http://vscode/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; } }

Related issue: https://github.com/microsoft/vscode/issues/208278

aeschli commented 6 months ago

code-insiders serve-web --server-base-path=/ides/foo

image

aeschli commented 6 months ago

That said, I have a problem when running with 0.0.0.0: code-insiders serve-web --host 0.0.0.0 --port 8080 --server-base-path=/ides/foo image