Skip to content

[Bug]: SSH environment: no port forwarding — loopback dev servers (localhost:5173) unreachable from the client and the preview panel #26890

Closed

Description

@bignosecss

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/desktop

Steps to reproduce

  1. On macOS, add an SSH environment pointing at a remote Ubuntu machine and let T3 Code launch its managed server there (remote server reported 0.1.4, listening on 127.0.0.1:3773).
  2. In a thread terminal on the remote, start a dev server that binds loopback only: pnpm dev:web → Vite prints Local: http://localhost:5173/ and listens on 127.0.0.1:5173 (Vite's default host: localhost).
  3. Open the printed URL from the thread (terminal link / preview panel).
  4. Also paste http://localhost:5173/ into Chrome on the macOS client.

Expected behavior

A remote dev server reachable at 127.0.0.1:5173 on the SSH host should be reachable from the client, the way VS Code Remote-SSH handles it: the client's localhost:5173 is forwarded over the existing SSH connection to the remote's 127.0.0.1:5173, so:

  • the in-app preview panel can load the page,
  • terminal links resolve to a target that actually works,
  • opening the URL in the client's own browser (or an "open externally" action) hits a forwarded local port.

Forwarding on demand from the discovered local servers (like VS Code's ports view, auto-forward on discovery) would be even better.

Actual behavior

  • Client browser: localhost:5173 → ERR_CONNECTION_REFUSED. The URL resolves on the Mac, where nothing listens.
  • The in-app preview panel cannot load it either; it does not reach the remote loopback.
  • The SSH tunnel appears to carry only the T3 server port. From reading packages/ssh/src/tunnel.ts, the -L forward is created for the managed server port (3773) only; the remote port scanner (apps/server/src/preview/PortScanner.ts) discovers the dev server, but nothing exposes that port to the client.
  • Suggested fix is not the user's job, but the shape that would match VS Code: forward each discovered remote loopback port on demand / automatically, and rewrite loopback preview targets through the forward.

Remote side for reference — both listeners are loopback-only:

$ ss -ltnp | grep -E ':5173|:3773'
LISTEN 0 511 127.0.0.1:3773 0.0.0.0:* users:(("node-MainThread",pid=574153,fd=23))
LISTEN 0 511 127.0.0.1:5173 0.0.0.0:* users:(("MainThread",pid=579997,fd=29))

Impact

Major degradation or frequent failure

Version or commit

Remote managed server 0.1.4 (SSH environment); desktop app connected from macOS.

Environment

Logs or stack traces

No response

Screenshots, recordings, or supporting files

No response

Workaround

Manual forward in a separate terminal, then open http://localhost:5173/ in the client browser:

ssh -N -L 5173:127.0.0.1:5173 <user>@<remote-host>

Alternatively start the dev server with --host / server.host: '0.0.0.0' and reach it on the remote's LAN/Tailscale address, which weakens isolation and does not work for servers that must stay loopback-only.

Activity

  1. locked and limited conversation to collaborators on Oct 29, 2026
  2. converted this issue into a discussion #26891 on Oct 29, 2026
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