Exposing the Proxy Dashboard¶
The dashboard is off by default, and once on, anyone who can reach its port can read it until you set a login. Before anyone but the proxy host reaches it, set what the list below names.
The rest of the page puts the dashboard behind a reverse proxy, then says what it guards against on its own, which ports to firewall, how it runs on an HA pair, and what it costs the proxy.
Before You Share It¶
- A login. Set
proxy.dashboard.password, from the environment asDASHBOARD_PASSWORDor from a Secret, and the dashboard asks for a login before it shows anything (Login). A login stops anyone who reaches the port; the settings below stop only a browser. - A private address. Keep the dashboard's port, 8094, on an internal network, or bind it to a private address with
proxy.dashboard.host:127.0.0.1keeps it on the proxy host (Ports). - TLS in front of it. The dashboard has no TLS, so put a reverse proxy that terminates TLS in front of
it (Behind a Reverse Proxy). Over
https, the dashboard marks its session cookieSecure. - The reverse proxy's headers. Have it pass the browser's
Hoston, or list the address viewers open inproxy.dashboard.allowedOrigins, so the live updates pass the Origin check. - The reverse proxy's address. List it in
proxy.dashboard.trustedProxies, so each viewer, not the reverse proxy, has a limit on wrong logins (Client Addresses). - The names viewers use. List the host names viewers open the dashboard by in
proxy.dashboard.allowedHosts, so it refuses a page that points a name it controls at it (DNS rebinding).
Two settings are yours to weigh: proxy.dashboard.framingEnabled = false refuses framing, which some policies and
security scanners require (Framing), and proxy.dashboard.scrapeNowEnabled = false takes
Scrape now away from the dashboard's readers. allowedOrigins, allowedHosts, and trustedProxies
are lists, so set them in a config file (Dashboard configuration).
Behind a Reverse Proxy¶
The dashboard's live updates come over a WebSocket, at /dashboard/events. A reverse proxy in front of it has to pass
the WebSocket's handshake on, and the handshake has to pass the Origin check. Two of nginx's defaults
stop it:
- With a plain
proxy_pass, nginx passes each request as HTTP/1.0 and drops theUpgradeandConnectionheaders, so the dashboard answers the handshake with 400. - With those headers but nginx's default
Host, the upstream's name, the browser'sOrigindoesn't match it. The dashboard refuses the handshake, Scrape now, and the login form with 403, and logsRefused a dashboard request from origin …; add it to proxy.dashboard.allowedOrigins if expected.
Either way, without a login the page loads and its live indicator stays on
reconnecting…. With a login, the login form is refused with 403, so the page never loads. Pass both headers, and
the browser's Host:
# Connection: upgrade on a WebSocket handshake, and close on anything else.
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 443 ssl;
ssl_certificate /etc/nginx/certs/server.pem;
ssl_certificate_key /etc/nginx/certs/server.key;
location /dashboard {
proxy_pass http://proxy-host:8094;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header Host $http_host;
# The browser's address, which the dashboard reads once nginx is in proxy.dashboard.trustedProxies.
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
# The screens page, outside the dashboard's path, which opens no WebSocket.
location = /screens {
proxy_pass http://proxy-host:8094;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
$http_host is the Host header as the browser sent it, port included. $host drops the port, which breaks the match
on a port other than the scheme's. To keep the Host nginx sets, list the address the browser opens in
proxy.dashboard.allowedOrigins instead, for example ["https://dashboard.example.com"].
Keep the path as it is. The page's links, its assets, and its WebSocket are all under proxy.dashboard.path, and the
screens page is at /screens, so a prefix nginx adds or strips breaks them. The session
cookie is set at those two paths, so leave its paths alone too, rather than have nginx rewrite cookie paths. Over
https, the dashboard marks its session cookie Secure.
Every request reaches the dashboard from nginx's address. Until you list that address in
proxy.dashboard.trustedProxies, the per-address limit on wrong logins is everyone's; see
Client Addresses. A direct agent dashboard takes the same settings under agent.dashboard. The
nginx Demo shows each step.
Client Addresses¶
The dashboard takes a client's address from its TCP connection, and uses it for:
- the limit on wrong logins, and the WARN for one;
- the Activity row of a Scrape now;
- how often the INFO for a refused
OriginorHostis logged.
Behind a reverse proxy, that's the reverse proxy's address, so every user shares one limit, and the log and the
Activity view name the reverse proxy. List the reverse proxies in proxy.dashboard.trustedProxies, each an IP address
or a CIDR range. A request whose connection comes from one of them then takes the client's address from its
X-Forwarded-For header instead:
Each reverse proxy appends the address it heard from to the header. So the dashboard reads the header from the right, skips each listed proxy's address, and takes the first address that isn't one. Anything a client writes in the header itself is to the left of that, so it can't choose its address.
- When every entry is a listed proxy, the dashboard takes the leftmost.
- A request from a peer that isn't listed keeps the peer's address, its header ignored. So does one whose header, read from the right, holds something other than an IP address before the client's.
- An entry may carry a port (
203.0.113.7:51000,[2001:db8::7]:4711), which is dropped. - The dashboard reads only
X-Forwarded-For, neverForwarded(RFC 7239): a reverse proxy that writes one passes a client's copy of the other on untouched.
List only the reverse proxies' addresses, never a network their clients are on. List only reverse proxies that set
the header or append to it in every location that forwards to the dashboard, as nginx's $proxy_add_x_forwarded_for
does in both locations of the example above.
A client that reaches the dashboard, or a listed reverse proxy, from a listed address can name any address it likes.
So can one sent through a location that leaves the header out: nginx passes a client's header on untouched there,
and a location with any proxy_set_header drops every one its server sets.
The proxy logs the list at startup. It refuses to start with an entry that isn't an IP address or a CIDR range, a range
with bits set past its prefix (10.1.2.3/16), or one that holds every address (0.0.0.0/0, ::/0).
Empty, the default, every client is its connection's peer. It's a list, so set it in a config file. The agent's
dashboard reads agent.dashboard.trustedProxies the same way.
Exposure¶
Without a login, anyone who can reach the dashboard's port can read it. Keep the port on an
internal network, or bind it to a private address with proxy.dashboard.host. Without a login, the proxy warns at
startup when the dashboard listens on all interfaces. With relayed agent dashboards on,
the same reach shows every connected agent's dashboard too.
A browser inside that network can still be used to reach it. A web page can do that in three ways. The dashboard guards against the first on its own, and against the other two with a setting each:
-
A WebSocket from another site. Browsers let any page open a WebSocket to any address, so the dashboard refuses a handshake whose
Originis not its host. Behind a reverse proxy that rewrites the Host header, the browser's origin is the proxy's public name, so list it inproxy.dashboard.allowedOrigins, or pass the browser's Host on; see Behind a Reverse Proxy.The dashboard can't tell whether a reverse proxy in front of it terminates TLS, so it takes its host over
httporhttps. An origin listed inallowedOriginspins its scheme for its host and port. Withhttps://dash.example.comlisted, a page athttp://dash.example.comis refused, though the Host the reverse proxy passes on matches. An origin must behttporhttps, a host, and an optional port, as a browser sends it. -
DNS rebinding. A page can point its DNS name at the dashboard's address. The browser then sends that name as both
OriginandHost, and the Origin check passes. List the names you reach the dashboard by inproxy.dashboard.allowedHosts, and it refuses any other host name with a 403, on every route.IP addresses,
localhost, and the hosts inallowedOriginsare always allowed. This check is off until you set it. -
Framing. A page can show the dashboard in a frame. That's allowed by default (
proxy.dashboard.framingEnabled), so a portal or another page of yours can embed the dashboard, and so can a page on another site that a viewer opens.Such a page can hide the dashboard under its content and steer the viewer's clicks onto Scrape now or Log out, since the frame's requests come from the dashboard's page and pass the Origin check. It can't read what the frame shows.
- With a login set, a page on another site gets only the login page, since the session cookie (
SameSite=Lax) isn't sent to a frame on another site. So a login in a frame works only on the same site. A site is a scheme and a registered domain: a page on another port of the dashboard's host, or on a sibling subdomain, is on the same site, and frames the signed-in dashboard. - Set
proxy.dashboard.framingEnabled = false, and every response forbids framing (Content-Security-Policy: frame-ancestors 'none', andX-Frame-Options: DENYfor older browsers), so no page, on any site, can frame it. - While the proxy serves the screens page, with screens listed or relayed agent
dashboards on,
falsestill lets the page show the dashboard. Every response then saysframe-ancestors 'self'andX-Frame-Options: SAMEORIGINinstead, so only a page of the dashboard's origin can frame it.
- With a login set, a page on another site gets only the login page, since the session cookie (
allowedOrigins and allowedHosts stop a browser, not someone who can reach the port directly; a login does.
What framing lets a page do to the dashboard is small: it can't read the frame, and the only clicks it can steer are Scrape now, within its cooldown, and Log out. The setting is there mostly for audits.
Security scanners such as ZAP, Burp, and Nessus flag a response with neither X-Frame-Options nor frame-ancestors as
missing an anti-clickjacking header. So an organization that scans its internal services finds the dashboard by
default, and framingEnabled = false answers that finding with one setting, no reverse proxy needed. If your policy
requires the header and the dashboard is behind a reverse proxy, you can add it there
instead, as nginx does with:
add_header Content-Security-Policy "frame-ancestors 'none'" always;
add_header X-Frame-Options DENY always;
The dashboard logs a request it refuses for its Origin or Host at INFO, naming the setting that would allow it. It
does so at most once a minute for each address the requests come from, and logs the rest at DEBUG. It cuts the header
to 270 characters, the longest a real one can be, and escapes its control characters, since a client sends it before
any login.
The Activity view shows the address each call with a bad token came from, so anyone who can read the dashboard can see who has tried the agent port.
Anyone who can reach the dashboard, with its login when one is set, can also have the
proxy scrape a path and read the first 2 KB of what it returns, even with the scrape
port firewalled to Prometheus. Set proxy.dashboard.scrapeNowEnabled = false where that is more than the dashboard's
readers should have.
The route takes a request only from the dashboard's page. It applies the same Origin check as the WebSocket, and requires the header the page's script sends, which a page on another site can't add without the proxy's permission. So a link or form elsewhere can't make it scrape.
A login doesn't replace these checks, so the dashboard keeps them with a login set, and checks the Origin of the login and Log out forms as well.
Open pages, one WebSocket each, are capped at proxy.dashboard.maxSessions (default 50). A client that sends an
oversized message is disconnected. So is one that stops reading, once 32 updates are waiting for it, which frees its
place under the cap, so no one client can hold up the others' updates.
A page's messages, which say what it shows, update it only when they change that, and at most once every 100 milliseconds, the first at once. So a client sending them in a loop can't have the proxy render its pages as fast as it sends.
Why It Is on a Separate Port¶
The proxy's admin port (8092) is a servlet container that cannot host WebSockets, so the dashboard could not live there even if that were desirable.
It also turns out to be the safer arrangement. Kubernetes liveness and readiness probes target /ping on the admin
port. If the dashboard shared that port, you could not firewall the dashboard without also cutting off your health
probes.
Ports in a fully-enabled proxy:
| Port | Purpose | Default |
|---|---|---|
| 8080 | Prometheus scrapes | enabled |
| 50051 | Agent gRPC connections | enabled |
| 8082 | Proxy's own metrics | disabled |
| 8092 | Admin servlets (/ping, /healthcheck, /debug) |
disabled |
| 8094 | Dashboard | disabled |
Offline and Airgapped Deployments¶
The dashboard loads no external assets. htmx ships inside the JAR as a WebJar dependency and is served from the classpath, so the dashboard renders with no outbound network access at all.
That matters for this product specifically: a proxy exists to bridge a network boundary and frequently runs where outbound internet is restricted. A CDN-hosted script would leave a blank page in exactly that environment, and it would fail when someone opens the page during an incident, not at deploy time.
Running an HA Pair¶
Each proxy's dashboard shows only the agents connected to that proxy. With proxy failover configured, an agent holds one connection at a time, so it appears on exactly one dashboard. The same holds for relayed agent dashboards: the standby's screens page shows an agent's only once it fails over to it.
An agent that reached this proxy by failing over says so. Its detail panel shows the endpoint it connected through and its position in the configured list:
The failed over marker appears whenever the agent is on anything other than its first endpoint, so an agent showing up on the standby is distinguishable from one starting fresh there. Agents with a single endpoint, or running a version predating this, show no position line.
To follow one specific agent across the pair, use its launch ID. That value is generated once per agent process, so it survives a failover and identifies the same process on whichever proxy it lands on. The agent ID will not match: each proxy assigns a different one.
Cost¶
The dashboard adds little work to the scrape path: each scrape leaves a record in its path's history. Updates are driven by an internal event bus whose publish operation is non-blocking, so it can never delay an agent registration or a scrape.
State is collected once per update and shared across every connected browser, so the cost does not scale with the
number of open dashboards. Loading or reloading a page reuses that collection too, as long as it is less than
refreshIntervalSecs old and no agent or path has changed since. So requesting pages in a loop can't make the proxy
collect any faster.
Counters that drift rather than change, such as backlog depth, map sizes, and eviction countdowns, refresh on
refreshIntervalSecs rather than on every event. A page on the Activity view is sent its table only when the feed or
its search has changed.
Agent screens cost memory while a page shows an agent: see What the Proxy Keeps.
Limits¶
- One action. Nothing on the dashboard changes the proxy's state. Its one action, scrape now, scrapes a target as Prometheus would.
- One shared login, over plain HTTP. The login is one username and password for everyone, and the dashboard has no TLS. Without a login, rely on network isolation, as with the admin port; see Exposure for what the dashboard itself guards against.
- Consolidated paths show one agent's target. When several agents register the same path, the row names one of
them, with the others counted in the
+N, and shows that agent's target URL and source. When it leaves, the row names the next agent and shows its target. The path's labels, which service discovery serves, stay the first registrant's. - Departed paths age out. A gone path stays for
departedPathRetentionSecs(default 3600) after its agent left or its last scrape, whichever is later. At most 1,000 are kept at once, and none survives a proxy restart. - An agent's recent scrapes are what its paths keep. Its panel lists its latest 25 from the
pathHistorySizescrapes (default 20) each path keeps. So an agent with one path lists at most 20, and a path shared with other agents holds theirs in the same 20. They go as their paths' histories do, and none survives a proxy restart. - The activity feed is short-lived. It keeps the last
activityLogSizerows (default 500), and none survives a proxy restart. - Agent screens are bounded in memory. The proxy keeps at most 64 MiB of one agent's state, and
proxy.dashboard.agentScreensMaxMBytes(96 by default) of every agent's together; see What the Proxy Keeps.