microsoft / vscode-remote-release

Visual Studio Code Remote Development: Open any folder in WSL, in a Docker container, or on a remote machine using SSH and take advantage of VS Code's full feature set.
https://aka.ms/vscode-remote
Other
3.55k stars 265 forks source link

feat: add port forwarding to wsl #8621

Open Sandros94 opened 1 year ago

Sandros94 commented 1 year ago

Recently I started coding more inside WSL than in Windows, but one issue made me reconsider this: the inability to expose WSL services to other networks with ease.

The main discussion about WSL not being able to expose services with ease to other networks can be fount in this WSL Issue. Thus we could say that this VSCode feature requests aim to be more like a workaround to that issue (that clearly is much more complex and not-soon to be resolved).

Would it be possible to import the Port tab and the automatic and/or manual Port Forwarding that are available with Remote-SSH and Remote-Tunnel? To my point of view this shouldn't be much complex, since the Port Forwarding feature is already available.

If needed I could write couple of use cases where this could be useful.

VSCodeTriageBot commented 1 year ago

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 10 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

Sandros94 commented 1 year ago

@alexr00 sorry for tagging you, I hate to disturb people, but could you explain a bit your comment on VSCode#186205?

This is by design. We do not support port forwarding with a WSL connection.

What would be the difference between creating an SSH tunnel to a WSL (that to my understanding lets you open up ports) vs making by design that normal WSL tunnels don't let you open them up? Are we talking about security concerns that made this decision?

alexr00 commented 1 year ago

Because ports used in WSL are already available on your local machine we don't bother doing any forwarding. We have simply never added any support for it. That's all.

Sandros94 commented 1 year ago

If it receives 10 upvotes we will move it to our backlog.

Thanks everyone! Looks like we got more than 10 upvotes in less than 10 hours. Let's hope the team is able to discuss this feature request, and eventually implement it.

VSCodeTriageBot commented 1 year ago

:slightly_smiling_face: This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

oenu commented 11 months ago

Interested in seeing where this goes, would really seal the remote dev deal

connor4312 commented 11 months ago

Could be merged into https://github.com/microsoft/vscode-internalbacklog/issues/4382

Sandros94 commented 10 months ago

Any update on this?

I've noticed that the Ports tab is now available and does automatically and manually expose WSL ports. But Those ports aren't proxied to the host ip if remote.localPortHost is set to allInterfaces, preventing other devices on the local netwrok to access them.

oenu commented 10 months ago

Any update on this?

I've noticed that the Ports tab is now available and does automatically and manually expose WSL ports. But Those ports aren't proxied to the host ip if remote.localPortHost is set to allInterfaces, preventing other devices on the local netwrok to access them.

I have been able to remote into a WSL session and have ports forwarded to my local machine. Does have some weirdness as it isnt using the vscode url thing that they did a while ago (where your port was forwarded to an obscure temp url from microsoft, but that might have been a codespaces thing).

I have had issues with selecting a project, on connecting to remote WSL I am just sitting at an empty project with no files open and if I attempt to open one it crashes the session, but when I reload the window it sometimes connects and works fine all day. Whats worked better is setting up a workspace with all my files on the remote machine first, then getting lucky with it opening after crash, then using the "recent projects" prompt to select the project on the remote machine. Works every time after that!

One note is that I am using tailscale to bidirectionally connect to my home net and provide access to databases hosted on the same net as my work laptop, so some of the heavy lifting/routing might be being handled for me.

oenu commented 10 months ago

*Im also using the insiders build for both machines

NZSmartie commented 1 month ago

Hi, I'm using Windows 10 Pro 22H2, and Visual Studio Code 1.89.1 with the extension WSL v0.88.2. With "remote.localPortHost": "allInterfaces" set in all User, Remote [WSL: ...] and Workspace settings, files; Port forwarding to all interfaces does not work and will only bind to localhost.

The alternative seems to use netsh interface portproxy manually, which I guess I can live with

I'm bumping to prevent this issue from getting stale