t3code icon indicating copy to clipboard operation
t3code copied to clipboard

Servers list opens HTTPS dev servers at http://, so the tab fails

Open vstratful opened this issue 1 week ago • 1 comments

What happened

A Next.js dev server started with next dev --experimental-https listens only for HTTPS on port 3000. The thread's Servers list shows it as http://localhost:3000, and clicking it opens the in-app browser at http://, which gets an empty reply. Typing https://localhost:3000 by hand works.

Diagnosis

apps/server/src/preview/PortScanner.ts builds every discovered listener as `http://localhost:${port}` (the lsof, /proc/net/tcp and Windows listener paths). This is deliberate: the comment above probeWebServers says owned listeners are listed as plain HTTP without a request, so that binary protocols aren't sent HTTP or TLS bytes. Only configured previewUrls are probed, and openDiscoveredPort opens port.url as given. Nothing ever records that a listener speaks TLS. Recent main commits to PortScanner.ts don't change this.

A possible gap with the previewUrl workaround: configured URLs are probed with the server's Node fetch. With default trust, Node rejects a locally issued certificate such as mkcert's (UNABLE_TO_VERIFY_LEAF_SIGNATURE on Node 24; not verified on the server's Node 26 runtime). A failed probe sets isWeb: false, which would silently drop an https:// previewUrl from the list.

Steps to reproduce

  1. In a project, run an HTTPS-only dev server, e.g. next dev --experimental-https (with mkcert certificates).
  2. Open the thread's info pane → Servers; the server appears as http://localhost:3000.
  3. Click it. The tab loads http://localhost:3000 and fails.

Expected: HTTPS-only servers open at https://, or the list offers a way to choose the protocol.

Version

T3 Code Desktop 0.1.11 (Windows) with the WSL server 0.1.11.

Environment

Windows 11 + WSL2 (Ubuntu), WSL-only mode, networkingMode=mirrored. Browser tabs run in the server's headless Chrome.

Evidence

curl https://localhost:3000 returns 200 and curl http://localhost:3000 gets an empty reply; the Servers entry shows http://.

Related issues

#30793 (server headless Chrome ignores the system CA store; same setup).

Workaround

Type https:// in the address bar, or set a project action's previewUrl to https://localhost:3000 (but see the probe caveat above).


Investigated and drafted by Claude Opus 5.5 (Claude Code) via T3 Code triage.

vstratful avatar Nov 23 '26 19:11 vstratful

Reproducing this now — I can confirm the diagnosis in apps/server/src/preview/PortScanner.ts: discovered listeners are always built as http://localhost:${port} and nothing records TLS. I will prepare a PR that probes the scheme of discovered listeners so HTTPS-only dev servers (e.g. next dev --experimental-https) are listed as https://.

four1er avatar Nov 23 '26 19:11 four1er