Localhost Tunnel Notes

long-tail guide · niche cluster

VS Code Remote-SSH: Forward a Localhost API Port

If you already use VS Code Remote-SSH, built-in port forwarding can replace a one-off ssh -L for day-to-day API calls.

Steps

  1. Connect to the VPS with Remote-SSH.
  2. Open the Ports tab.
  3. Forward the remote port (e.g. 3000) to a local port.
  4. Set visibility to localhost-only on your Mac.
  5. Call http://127.0.0.1:3000 from local terminals or browsers.

When to prefer raw SSH

Scripts, CI, or non-VS Code editors: keep ssh -L / autossh. VS Code forwarding is convenience, not a security boundary by itself — the VPS service should still bind to 127.0.0.1.