Skip to content

Support forwarding to other hosts only reachable from remote in remote.SSH.defaultForwardedPorts (like the Ports tab) #11929

Open

Description

@MoBa846

Feature request: Support forwarding to other hosts in remote.SSH.defaultForwardedPorts (like the Ports tab)

  • VS Code Version: 1.139.1
  • Remote-SSH Version: 0.128.0
  • Local: Windows
  • Remote: Linux
  • Remote Connection Type: SSH

Description

Related to #9715.

In the Ports tab, I can forward a port on a host that is reachable from the SSH remote (not the remote itself) by entering hostname:port. This works perfectly:

Port Forwarded Address Origin
hostname:8080 localhost:8080 User Forwarded
hostname:2705 localhost:2705 User Forwarded

However, there is no way to configure the same forwards in settings.json via remote.SSH.defaultForwardedPorts:

"remote.SSH.defaultForwardedPorts": [
    {
        "name": "Service on other host",
        "localPort": 8080,
        "remotePort": 8080,
        "host": "hostname"          // ignored: forwarding remote localhost
    },
    {
        "name": "Service on other host",
        "localPort": 2705,
        "remotePort": "hostname:2705" // Incorrect type. Expected number
    }
]

Expected behavior

remote.SSH.defaultForwardedPorts should support the same targets as the Ports view, either via:

  1. a new optional host property (default: localhost), or
  2. accepting "hostname:port" as remotePort like in the ports tab.

Use case

Services in an internal network are only reachable through the SSH remote (jump host).
Currently I can configure this with LocalForward in ~/.ssh/config or forward ports manually in the Ports view, but I would like to define these forwards in settings.json, together with my other port forwards, without depending on the SSH config which makes setting dynamic ports via attributes easier.

Screenshot eith the wanted behavior from the ports tab

Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions