Currently, when you share a server, you specify the TCP port the server is listening on, which transparently spins up a TCP proxy on the guest's machine and routes traffic back-and-forth on that port. This experience works well for many cases, however, there are scenarios where the TCP port alone isn't enough context to allow the guest to immediately begin collaborating with the host. For example:
If you're working on a specific page in your web app, which is available at http://localhost:3000/foo/bar, then you'd need to share port 3000 and then ask the guest to manually navigate to the right URL. Otherwise, if they opened the shared server in their browser (e.g. by clicking the shared server in the Live Share viewlet), they'd simply navigate to http://localhost:3000.
If your site is only available via https, then you'd need to share the port and then expect the guest to navigate to https://*. By default, if a guest uses the commands to launch a shared server in their browser, or copy its URL to their clipboard, it will assume the URL is http://localhost:<PORT>.
In order to accomodate all of these scenarios, without introducing extra complexity for the simple cases, we could allow the host to specify a port or a URL when sharing a server. This way, the TCP proxy setup could continue to happen as-is, but if needed, we could roundtrip a URL to guests, and allow them to quickly launch their browser to it or copy it to their clipboard via the explorer view (VS Code) or shared server dialog (VS). From a design perspective, I think we can simply update the "port" input to accept a URL as well (that defaults to port 80 if unspecified?), as opposed to needed to introduce a third field (in addition to the port and display name).
This has been addressed in the latest Live Share extension update.
Hello, currently the VSCode share server input (port or url) doesn't allow urls other than https?:\/\/localhost(:[\d]+)?, would it be possible to allow port forwarding to other ip|domain:port combinations? I rarely develop with a server on my local machine (never in fact), although the code is local, so it would be nice to be able to allow other urls.
Take for instance a scenario with Vagrant where your source code is in a shared folder, but the web server is running in a virtual machine... Of course you could forward the vm guest port to the host and then live-share this port, but it would be much simpler to allow live-share to point to the local ip:port of the vm. It also happens quite often that I would like to share a port from a different machine on my network, without exposing this port externally or via vpn/ssh/whatever... Allowing other urls would also solve this problem.
What do you think? Thanks!
Most helpful comment
Hello, currently the VSCode share server input (port or url) doesn't allow urls other than
https?:\/\/localhost(:[\d]+)?, would it be possible to allow port forwarding to other ip|domain:port combinations? I rarely develop with a server on my local machine (never in fact), although the code is local, so it would be nice to be able to allow other urls.Take for instance a scenario with Vagrant where your source code is in a shared folder, but the web server is running in a virtual machine... Of course you could forward the vm guest port to the host and then live-share this port, but it would be much simpler to allow live-share to point to the local ip:port of the vm. It also happens quite often that I would like to share a port from a different machine on my network, without exposing this port externally or via vpn/ssh/whatever... Allowing other urls would also solve this problem.
What do you think? Thanks!