fix: support reverse proxy domains via HERMES_DASHBOARD_EXTRA_HOSTS env var - #22437
fix: support reverse proxy domains via HERMES_DASHBOARD_EXTRA_HOSTS env var#22437Cyrene963 wants to merge 1 commit into
Conversation
…nv var When the dashboard is bound to 127.0.0.1, the Host header validation middleware rejects requests from reverse proxy domains (e.g. webui.bz9.me via Cloudflare). This makes the dashboard unusable behind any reverse proxy without --insecure (0.0.0.0 bind). Add HERMES_DASHBOARD_EXTRA_HOSTS environment variable support to _is_accepted_host(). When set (comma-separated list of hostnames), the specified domains are accepted alongside the loopback aliases. Usage: HERMES_DASHBOARD_EXTRA_HOSTS=webui.bz9.me hermes dashboard # or in systemd: Environment=HERMES_DASHBOARD_EXTRA_HOSTS=webui.bz9.me,admin.example.com This is more secure than --insecure because it keeps the loopback bind while only adding specific trusted hostnames.
|
Re-evaluating closure status for #22437 I closed this after noting competing implementations, but I rechecked the referenced alternatives and do not see a merged replacement yet. Reopening so this small reverse-proxy host support fix remains trackable; if maintainers prefer the config-based shape from another PR, I can adapt this branch accordingly. |
|
Thanks for the focused reverse-proxy use case and the narrowly scoped implementation.
This is an automated hermes-sweeper review. Closed as not-planned per standing maintainer policy ( |
Problem
When the dashboard is bound to
127.0.0.1(default), the Host header validation middleware rejects requests from reverse proxy domains (e.g.webui.bz9.mevia Cloudflare). This makes the dashboard unusable behind any reverse proxy without using--insecure(which binds to0.0.0.0).The user sees a blank page because:
Invalid Host header)Solution
Add
HERMES_DASHBOARD_EXTRA_HOSTSenvironment variable support to_is_accepted_host(). When set (comma-separated list of hostnames), the specified domains are accepted alongside the loopback aliases.Usage
Why not --insecure?
--insecurebinds to0.0.0.0, which exposes the dashboard to the entire network. The env var approach keeps the loopback bind while only adding specific trusted hostnames — much safer for users behind Cloudflare, Caddy, or Nginx reverse proxies.Changes
hermes_cli/web_server.py: 7 lines added to_is_accepted_host()— readsHERMES_DASHBOARD_EXTRA_HOSTSenv var and accepts matching hostnames.