microsoft / vscode

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

local https for serve-web #203730

Closed crbyxwpzfl closed 8 months ago

crbyxwpzfl commented 8 months ago

tldr

with code serve-web --host 0.0.0.0 --without-connection-token Jupyter notebooks alias .ipynb files won’t work and stay blank see blow

screenshot

screencap

to resolve this is use caddy with sudo caddy run —config /etc/caddy/Caddyfile

pi.local {
        reverse_proxy 127.0.0.1:8000
}

to put a reverse proxy with local signed tls cert in front of it like @connor4312 suggested here and removed —host 0.0.0.0 as this defaults to localhost only

more info

this is probably the wrong place to put this but the issue mentioned above is locked i want to document this for me and perhaps others. other than that the code cli features are so cool and simple to use. furthermore I know this very insecure but since I use this locally only with a pi connected via usbc to a ipad this seems tolerable to me please let me know otherwise. anyways please close this if this is irrelevant or covered else where.

other findings

with just code serve-web --host 0.0.0.0 or with —connection-token im not able to connect via a browser on a ipad to the pi. perhaps the browser strips the token duno plus just for Jupyter agein for some reason the ipad has to have wlan enabled even though the connection is local

connor4312 commented 8 months ago

I don't have any plans to do this; the serve-web interface is not designed as a public-facing server at the moment. Using Caddy or something similar is the way to go.