fix(headroom): proxy dashboard through app (#2372)

Add a 9Router-side proxy so the Headroom dashboard and its data
endpoints (/stats, /health, /stats-history, /transformations/feed)
stay same-origin when opened remotely through the 9Router app, and
add an "Open Headroom Dashboard" link in the Token Saver modal.

Gate /api/headroom/proxy as LOCAL_ONLY (loopback + CLI token) to
match start/stop, and strip cookie/authorization when the Headroom
target is non-loopback to avoid leaking viewer credentials.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Sutarto Jordan Chrisfivo
2026-07-05 17:45:04 +07:00
committed by decolua
co-authored by Cursor
parent 008de32c06
commit 481e7e467b
3 changed files with 115 additions and 0 deletions
+1
View File
@@ -81,6 +81,7 @@ const LOCAL_ONLY_PATHS = [
"/api/auth/reset-password",
"/api/headroom/start",
"/api/headroom/stop",
"/api/headroom/proxy",
];
const LOOPBACK_HOSTS = new Set(["localhost", "127.0.0.1", "::1"]);