You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Server preview browser opens /api/assets links on the client's public origin, which the server can't reach (ERR_CONNECTION_REFUSED behind tailscale serve) #32898
I searched existing issues and did not find a duplicate.
I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
Run the T3 Code server on a headless Linux box, bound to loopback (T3CODE_HOST=127.0.0.1, T3CODE_PORT=3773), and put it behind an HTTPS reverse proxy that is reachable only from other machines, e.g. tailscale serve → https://<box>.<tailnet>.ts.net → 127.0.0.1:3773.
Open T3 Code Web from another machine at https://<box>.<tailnet>.ts.net.
In a thread, open a workspace file in the browser preview. The preview opens a tab at https://<box>.<tailnet>.ts.net/api/assets/<token>.
Expected behavior
The file renders in the preview tab. The preview browser runs on the server, so it should load assets from an origin the server itself can reach (its own listen address, e.g. http://127.0.0.1:3773), not from the origin the remote client used.
Actual behavior
The preview tab shows This site can't be reached … ERR_CONNECTION_REFUSED. The same URL loads fine (200) in the client's normal browser.
As far as I can tell, the asset URL is built from the client's public origin but opened in the server-side chrome-headless-shell (the resident server browser, see #18165 and #21686). That origin is often unreachable from the server itself:
tailscale serve only accepts connections arriving over the tailnet interface, so a node can't reach its own Serve URL.
In my case the hostname also resolves to the box's LAN IP inside the box (a /etc/hosts entry), and nothing listens on :443 there.
The same applies to any reverse proxy, tunnel or NAT setup where the public hostname doesn't loop back to the server.
Impact
Minor bug or occasional failure
Version or commit
0.1.6 (stable)
Environment
Server: Debian 13 (unprivileged Proxmox LXC), T3 Code 0.1.6 running as a systemd user service, bound to 127.0.0.1:3773, exposed via tailscale serve (HTTPS :443). Client: T3 Code Web in Chrome on Windows, connected over Tailscale.
Logs or stack traces
# inside the server box
$ ss -tlnp | grep -E ':443|:3773'
LISTEN 0 4096 100.x.y.z%tailscale0:443 0.0.0.0:* users:(("tailscaled",...))
LISTEN 0 511 127.0.0.1:3773 0.0.0.0:* users:(("node-MainThread",...))
Workaround
In the preview tab's address bar, replace the origin with the server's local address and keep the path: https://<box>.<tailnet>.ts.net/api/assets/<token> → http://127.0.0.1:3773/api/assets/<token>. The file then renders.
Possible fix: when the URL is opened by the server-side preview browser, rewrite (or generate) /api/assets links against the server's own listen address. Alternatively, add a setting for the origin the preview browser should use.
Activity