iOS: terminal fails with "connection closed 1006" although Connect from is "Termix server"; app dials SSH from the phone or never opens /plugin-ws/
What happened?
Opening the terminal for an SSH host fails on iOS with "connection closed 1006", although the host's Connect from is set to Termix server. The same host works in Safari on the same iPhone and in Termix Desktop 26.11.0 on macOS, through the same reverse proxy and server.
What I could see on the server side (packet capture between the reverse proxy and the Termix container, plus the Termix and sshd logs):
- The app talks to the server fine. Sign-in (OIDC),
/users/me,/host/db/host,/sync/v2/*,/plugin-api/*andPOST /open-tabsall reach Termix and return 200. User agentTermix-Mobile/iOS. - The terminal WebSocket never reaches the server. Across several attempts there is no request to
/plugin-ws/ssh-terminal/terminal(or any other/plugin-ws/or/ssh/websocket/path), and Termix logs no terminal session for these attempts. Browser and desktop sessions show up as usual (Terminal WebSocket connection established,SSH connection established). - Twice the phone dialled the SSH host directly instead: a TCP connection from the phone's VPN address to the host's port 22, with the host's username. sshd refused it (
not listed in AllowUsers, the user may only log in from the Termix server), and the app showed 1006. This happened while the host was set to Termix server (screenshot of the host sheet available). - After unlinking the server and linking it again (fresh sign-in, same Termix user), the terminal still fails with 1006. In that attempt I saw neither a direct SSH connection from the phone nor a terminal WebSocket at the server.
So with Termix server selected, the app either opens SSH from the phone or fails before the relay WebSocket is sent.
Steps to reproduce
- Server 26.11.0 behind a reverse proxy (Traefik v3, HTTPS, HTTP/2 enabled). The SSH host only accepts the Termix server as source.
- In the iOS app, link the server and sign in.
- On the host, set Connect from to Termix server.
- Tap Terminal.
What did you expect?
The app opens the relay WebSocket wss://<server>/plugin-ws/ssh-terminal/terminal and the server opens SSH, as the browser and the desktop app do. It should never dial the host from the phone while Termix server is selected.
App version
TestFlight, latest as of 2026-11-08 (CFNetwork user agent Termix/131)
Platform
iOS
Device and OS version
iPhone, iOS with Darwin 27.2.0 (CFNetwork/3896.200.61)
Termix server version
26.11.0 (Docker image built 2026-11-01)
Logs
sshd on the SSH host during two app attempts (phone on WireGuard VPN, host set to Termix server):
sshd: User <host-user> from <phone-vpn-ip> not allowed because not listed in AllowUsers
sshd: Connection closed by invalid user <host-user> <phone-vpn-ip> port 63225 [preauth]
sshd: User <host-user> from <phone-vpn-ip> not allowed because not listed in AllowUsers
sshd: Connection closed by invalid user <host-user> <phone-vpn-ip> port 63230 [preauth]
Requests from the app seen between the proxy and Termix during a failing attempt (no /plugin-ws/ request at all):
GET /users/me 200
GET /host/db/host 200
GET /open-tabs/active-sessions 200
GET /plugin-api/host-metrics/metrics/1 200
GET /sync/v2/host-status 200
POST /open-tabs 200
Anything else?
- The proxy passes WebSocket upgrades: an HTTP/1.1 upgrade to
/plugin-ws/ssh-terminal/terminalgets101 Switching Protocols. - The proxy negotiates HTTP/2 via ALPN but does not advertise
SETTINGS_ENABLE_CONNECT_PROTOCOL(no WebSockets over HTTP/2). If the native iOS socket (NetSession.swift,URLSessionWebSocketTask) tries the relay over HTTP/2, it would fail before reaching Termix, andfinishSocketreports code 0 as 1006. I could not confirm this from the proxy logs. - The account showed "Copy on this phone" before I re-linked it. Earlier terminal tabs may have been created with Automatic; maybe a restored tab keeps its old origin.
Auto-triage
iOS app fails to open SSH terminal via server relay, showing 'connection closed 1006' and sometimes attempting direct SSH connections despite 'Connect from' being set to 'Termix server'.
| Field | Value |
|---|---|
| Type | Bug |
| Difficulty | 3/5 (Moderate) |
| Priority | High |
A maintainer will take a look. If anything above looks wrong, just say so.