feat(dashboard): HERMES_DASHBOARD_EXTRA_HOSTS for reverse-proxy WS Origin - #70064
feat(dashboard): HERMES_DASHBOARD_EXTRA_HOSTS for reverse-proxy WS Origin#70064Dbillionaer wants to merge 1 commit into
Conversation
…igin When the dashboard is bound to loopback and served behind a reverse proxy (nginx, Tailscale Serve, Cloudflare Tunnel, etc.), HTTP pages work because the proxy rewrites the Host header. WebSocket upgrades fail because the browser Origin header contains the proxy hostname while bound_host is 127.0.0.1. The browser-set Origin cannot be rewritten by the proxy. This adds HERMES_DASHBOARD_EXTRA_HOSTS - a comma-separated env var of operator-defined trusted hostnames that _is_accepted_host() accepts in addition to the bound host and loopback aliases. All existing security checks remain intact (DNS rebinding defense, auth gate, peer check). Closes NousResearch#70059. Related: NousResearch#34390, NousResearch#55917.
Related: #42344 and #68251 use the existing dashboard.public_url as the trust source, while this PR adds a separate comma-separated hostname allowlist. Both address proxy-origin acceptance, but selecting the intended configuration contract needs a maintainer decision. |
|
Thanks for isolating a real reverse-proxy WebSocket failure. Current
This is an automated hermes-sweeper review. Closed as not-planned per standing maintainer policy ( |
Summary
When the Hermes dashboard is bound to loopback (
127.0.0.1) and served behind a reverse proxy (nginx → Tailscale Serve, Cloudflare Tunnel, etc.), HTTP pages work because the proxy rewrites theHostheader. WebSocket upgrades fail because the browser'sOriginheader contains the proxy hostname (e.g.srv1480921.tail230ee9.ts.net) whilebound_hostis127.0.0.1.The browser-set
Originis a security header — it cannot be rewritten by the proxy. So every WS endpoint (/api/pty,/api/console,/api/ws) is rejected with:This PR adds
HERMES_DASHBOARD_EXTRA_HOSTS— a comma-separated env var of operator-defined trusted hostnames that_is_accepted_host()accepts in addition to the bound host and loopback aliases.Usage
# systemd unit / env HERMES_DASHBOARD_EXTRA_HOSTS=srv1480921.tail230ee9.ts.netFor operators with multiple proxy hostnames:
Security
All existing security checks remain fully intact:
Only hostnames the operator explicitly lists are accepted. This is strictly additive — it doesn't widen acceptance for any host not in the list.
Changes
hermes_cli/web_server.py: 9-line addition to_is_accepted_host()— checksHERMES_DASHBOARD_EXTRA_HOSTSenv var before the existing bound-host validationRelated
Test plan
HERMES_DASHBOARD_EXTRA_HOSTS=<hostname>, verify WS Origin with that hostname is accepted