fix(api): Cache-Control: no-cache on dashboard HTML #148

Merged
razvandimescu merged 1 commits from fix/dashboard-cache into main 2026-04-24 22:59:30 +08:00
razvandimescu commented 2026-04-24 22:51:34 +08:00 (Migrated from github.com)

Summary

  • The dashboard route (GET /) returned the embedded HTML with no Cache-Control header. With no Last-Modified either, browsers fall back to heuristic caching and may serve the stale copy for a long time after a numa upgrade.
  • This is what the reporter in #144 was seeing: binary was v0.14.2 (confirmed via numa --version and the queries.upstream key in /stats), but the rendered dashboard still matched a pre-v0.14.0 build — no Upstream row in Resolution Paths, and the zero-count filter wasn't kicking in. Both were dashboard changes that shipped weeks ago.
  • Fix: send Cache-Control: no-cache on the dashboard response. Browsers will revalidate on every load; since there's no ETag the response is always re-delivered, but it's ~60KB served locally and only on page load (data refresh stays on /stats), so the cost is negligible.

Test plan

  • cargo test api::tests::dashboard_returns_html — existing test now also asserts the header
  • cargo fmt --check
  • cargo clippy --lib -- -D warnings
  • Manual: upgrade a running numa, hit http://127.0.0.1:5380/ in a browser that previously had the page open, confirm the new dashboard renders without a hard reload

Closes #144.

## Summary - The dashboard route (`GET /`) returned the embedded HTML with no `Cache-Control` header. With no `Last-Modified` either, browsers fall back to heuristic caching and may serve the stale copy for a long time after a numa upgrade. - This is what the reporter in #144 was seeing: binary was v0.14.2 (confirmed via `numa --version` and the `queries.upstream` key in `/stats`), but the rendered dashboard still matched a pre-v0.14.0 build — no Upstream row in Resolution Paths, and the zero-count filter wasn't kicking in. Both were dashboard changes that shipped weeks ago. - Fix: send `Cache-Control: no-cache` on the dashboard response. Browsers will revalidate on every load; since there's no ETag the response is always re-delivered, but it's ~60KB served locally and only on page load (data refresh stays on `/stats`), so the cost is negligible. ## Test plan - [x] `cargo test api::tests::dashboard_returns_html` — existing test now also asserts the header - [x] `cargo fmt --check` - [x] `cargo clippy --lib -- -D warnings` - [ ] Manual: upgrade a running numa, hit `http://127.0.0.1:5380/` in a browser that previously had the page open, confirm the new dashboard renders without a hard reload Closes #144.
Sign in to join this conversation.