Skip to content

Commit

Permalink
Edits to recent updates
Browse files Browse the repository at this point in the history
Greg Van Liew committed Sep 5, 2023
1 parent cbf044b commit 2495209
Showing 6 changed files with 130 additions and 120 deletions.
2 changes: 0 additions & 2 deletions build/keybindings/doc.keybindings.win.json
Original file line number Diff line number Diff line change
@@ -1213,8 +1213,6 @@
"when": "accessibilityModeEnabled && terminalFocus && terminalHasBeenCreated && terminalTabFocusMode || accessibilityModeEnabled && terminalFocus && terminalHasBeenCreated && !terminalAccessibleBufferFocus || accessibilityModeEnabled && terminalFocus && terminalProcessSupported && terminalTabFocusMode || accessibilityModeEnabled && terminalFocus && terminalProcessSupported && !terminalAccessibleBufferFocus" },
{ "key": "ctrl+up", "command": "workbench.action.terminal.focusAccessibleBuffer",
"when": "accessibilityModeEnabled && terminalFocus && terminalHasBeenCreated && terminalTabFocusMode || accessibilityModeEnabled && terminalFocus && terminalHasBeenCreated && !terminalAccessibleBufferFocus || accessibilityModeEnabled && terminalFocus && terminalProcessSupported && terminalTabFocusMode || accessibilityModeEnabled && terminalFocus && terminalProcessSupported && !terminalAccessibleBufferFocus" },
{ "key": "shift+tab", "command": "workbench.action.terminal.focusAccessibleBuffer",
"when": "accessibilityModeEnabled && terminalFocus && terminalHasBeenCreated && terminalTabFocusMode || accessibilityModeEnabled && terminalFocus && terminalHasBeenCreated && !terminalAccessibleBufferFocus || accessibilityModeEnabled && terminalFocus && terminalProcessSupported && terminalTabFocusMode || accessibilityModeEnabled && terminalFocus && terminalProcessSupported && !terminalAccessibleBufferFocus" },
{ "key": "ctrl+f", "command": "workbench.action.terminal.focusFind",
"when": "terminalFindFocused && terminalHasBeenCreated || terminalFindFocused && terminalProcessSupported || terminalFocus && terminalHasBeenCreated || terminalFocus && terminalProcessSupported" },
{ "key": "ctrl+k ctrl+i", "command": "workbench.action.terminal.focusHover",
5 changes: 5 additions & 0 deletions build/sitemap.xml
Original file line number Diff line number Diff line change
@@ -265,6 +265,11 @@
<changefreq>weekly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://code.visualstudio.com/docs/editor/port-forwarding</loc>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://code.visualstudio.com/docs/sourcecontrol/overview</loc>
<changefreq>weekly</changefreq>
29 changes: 14 additions & 15 deletions docs/editor/port-forwarding.md
Original file line number Diff line number Diff line change
@@ -3,51 +3,50 @@ Order: 23
Area: editor
TOCTitle: Port Forwarding
ContentId: d7a80c88-c091-4d13-9240-d432c12407a7
PageTitle: Port Forwarding Local Services
PageTitle: Port forwarding local services with VS Code
DateApproved: 8/3/2023
MetaDescription: Make your local web services accessible over the internet.
MetaDescription: Make your local web services accessible over the internet with Visual Studio Code
---

# Local Port Forwarding

Support for port forwarding is built into Visual Studio Code, no extension required. When running a local web service, you can use the **Ports** view to make the service accessible to others over the internet.

## How to use Local Port Forwarding
## How to use local port forwarding

First, you need to have service you want to forward. If you don't have one yet but do have Node.js installed, you can run this command to start up a server on port 3000:

```
```bash
npx serve
```

Then, navigate to the **Ports** view, and click **Forward a Port**.
Then, navigate to the **Ports** view, and select **Forward a Port**.

![](./images/port-forwarding/ports-view.png)
![Forward a Port button displayed in the Ports view](images/port-forwarding/ports-view.png)

If you haven't logged in with Github before, you'll be prompted to log in. Then, enter the port you'd like to forward; the default port using the above command is port 3000. Once you do, the port forwarding system will be started and the **Ports** view will update to show the port you forwarded and its "Forwarded Address."
If you haven't logged in with GitHub before, you'll be prompted to sign in. Then, enter the port you'd like to forward; the default port using the above command is port 3000. Once you do, the port forwarding system starts and the **Ports** view updates to show the port you forwarded and its **Forwarded Address**.

![](./images/port-forwarding/forwarded-port.png)
![Port 3000 added to the Ports view](images/port-forwarding/forwarded-port.png)

Hovering over the Forwarded Address, you can use the inline actions copy the address, open it in your browser, or open an in-editor preview.
Hovering over the **Forwarded Address**, you can use the inline actions copy the address, open it in your browser, or open an in-editor preview.

By default, the forwarded port is **Private**. When you navigate to the URL, you'll be required to log in with the same Github account you used to start the port forwarding process in VS Code. You can change the visibility right clicking on the port and selecting **Port Visibility > Public**. **Public** ports don't require login.
By default, the forwarded port is **Private**. When you navigate to the URL, you'll be required to sign in with the same GitHub account you used to start the port forwarding process in VS Code. You can change the visibility right-clicking on the port and selecting **Port Visibility > Public**. **Public** ports don't require sign in.

## Common questions

### How do I forward local services if I'm connected to a remote machine?

Currently, port forwarding only works to expose locally-running services. It doesn't work in remote connections yet, although we expect it to in the future.

Depending on your scenario, you may want to use the VS Code [Remote-Tunnels](https://marketplace.visualstudio.com/items?itemName=ms-vscode.remote-server) extension to tunnel into a remote machine. You can learn more in the [Remote-Tunnels documentation](/docs/remote/tunnels.md).
Depending on your scenario, you may want to use the VS Code [Remote - Tunnels](https://marketplace.visualstudio.com/items?itemName=ms-vscode.remote-server) extension to tunnel into a remote machine. You can learn more in the [Remote - Tunnels documentation](/docs/remote/tunnels.md).

### How are forwarded ports secured?

By default, both hosting and connecting to a tunnel requires authentication with the same Github or Microsoft account on each end. In both cases, VS Code will make outbound connections to a service hosted in Azure; no firewall changes are generally necessary, and VS Code doesn't set up any network listeners.
By default, both hosting and connecting to a tunnel requires authentication with the same GitHub or Microsoft account on each end. In both cases, VS Code makes outbound connections to a service hosted in Azure; no firewall changes are generally necessary, and VS Code doesn't set up any network listeners.

However, if you've opened a **Public** port, any user with your link can access the forwarded service. You should be careful to avoid hosting any confidential information or insecure services over such ports.

If you're part of an organization who wants to control access to port forwarding, you can do so by allowing or denying access to the domain `global.rel.tunnels.api.visualstudio.com`.
If you're part of an organization that wants to control access to port forwarding, you can do so by allowing or denying access to the domain `global.rel.tunnels.api.visualstudio.com`.

### What limits are there on port forwarding?

There are limits to both the amount of bandwidth used and the number of active machines that can be used in port forwarding, which are subject to change over time. Read more about tunnel usage limits [here](https://aka.ms/vscode-dev-tunnel-limit).
There are limits to both the amount of bandwidth used and the number of active machines that can be used in port forwarding, which are subject to change over time. Read more about tunnel usage limits in the [Tunnels](https://aka.ms/vscode-dev-tunnel-limit) documentation.
3 changes: 3 additions & 0 deletions release-notes/images/1_82/action-control-fuzzy-search.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions release-notes/images/1_82/ports-view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Oops, something went wrong.

0 comments on commit 2495209

Please sign in to comment.