Single-port deployments can't serve dashboard + mux through one upstream proxy
Summary
Even after accepting /ao-terminal-mux as an alias on direct-terminal-ws (see #1795), operators still need their reverse proxy to support path-based ingress to two different upstream ports — regular dashboard traffic → PORT, /ao-terminal-mux → DIRECT_TERMINAL_PORT.
Several common proxy configurations can't do that — they forward one hostname:port pair to one upstream service::
- Cloudflare Tunnel managed via the Zero Trust dashboard — path-based ingress requires switching to a local
config.yml, which means giving up dashboard-managed config and re-creating the tunnel locally. - Managed app platforms — Fly.io, Render, Railway, etc. typically map an external hostname to one container port.
- Simple reverse-proxy presets —
caddy reverse-proxy --to :8094, plain nginx with oneproxy_pass, k8s Service / Ingress with one backend.
For those deployments there's no way to make terminals work without provisioning extra subdomains/ports — which is often outside the user's control or adds significant DNS/TLS overhead.
Proposed
Add an opt-in AO_PATH_BASED_MUX=1 env var. When set, start-all.ts spawns a small bundled HTTP/WS proxy on PORT that demultiplexes:
- HTTP requests → forwarded to Next.js (shifted to
PORT + 1000, override withNEXT_INTERNAL_PORT) wss://hostname/ao-terminal-muxupgrades → tunneled toDIRECT_TERMINAL_PORT/mux- Other WS upgrades → rejected (Next.js production doesn't use any)
One proxy rule (hostname → PORT) is then sufficient — the WS path is multiplexed onto the same TCP port and demuxed inside the AO process. Tradeoff: an extra Node process and one HTTP hop per request, in exchange for one-line proxy configuration on the operator side.
Strictly opt-in. Default off, existing direct-by-port flow unchanged.
PR addressing this: #1757 (commit 86b85d27)
@prod-blip new issue from a non-collaborator.
Hi @thapecroth , thanks for filing this, it is really detailed and useful. I'm a contributor on AO and trying to get a sense of how it's working for folks using it in real workflows. Would love to hear a bit more about your experience and happy to hop on a quick 15-min call if that's easier. Here’s my calendly link https://calendly.com/atulpandey-iift1618/30min
Also, the contributors meet on Discord every day at 10pm IST: https://discord.gg/6KgeUjbe — drop in if you're around, good place to see what's being worked on and shape direction directly.