Panel: index.html is cached by the browser after an upgrade (no Cache-Control) #205

Closed
opened 2026-11-15 09:02:04 +00:00 by vivy · 1 comment
Owner

Found on the test server on 2026-11-15 (GRI-2051). After an upgrade the product owner's browser kept showing the old panel until a hard refresh.

Cause. crates/server/src/http.rs:88 serves the panel with ServeDir and falls back to ServeFile(index.html). Neither sets Cache-Control. So a browser may reuse a cached index.html by heuristic, and that file points at the old hashed assets/index-*.js.

Fix.

  • index.html (direct and through the SPA fallback): Cache-Control: no-cache — the browser must revalidate every time. An ETag/Last-Modified keeps that cheap (304).
  • /assets/* (Vite output, content-hashed names): Cache-Control: public, max-age=31536000, immutable.
  • Anything else in the panel directory: no-cache.

Acceptance. A test on router_with_panel reads the header on /, on an SPA path such as /playlists/x, and on a hashed asset. After an upgrade, a normal reload shows the new panel.

Must land before the campus deploy: the colleagues there will not know to press Ctrl+Shift+R.

Found on the test server on 2026-11-15 (GRI-2051). After an upgrade the product owner's browser kept showing the old panel until a hard refresh. **Cause.** `crates/server/src/http.rs:88` serves the panel with `ServeDir` and falls back to `ServeFile(index.html)`. Neither sets `Cache-Control`. So a browser may reuse a cached `index.html` by heuristic, and that file points at the old hashed `assets/index-*.js`. **Fix.** - `index.html` (direct and through the SPA fallback): `Cache-Control: no-cache` — the browser must revalidate every time. An ETag/Last-Modified keeps that cheap (304). - `/assets/*` (Vite output, content-hashed names): `Cache-Control: public, max-age=31536000, immutable`. - Anything else in the panel directory: `no-cache`. **Acceptance.** A test on `router_with_panel` reads the header on `/`, on an SPA path such as `/playlists/x`, and on a hashed asset. After an upgrade, a normal reload shows the new panel. Must land before the campus deploy: the colleagues there will not know to press Ctrl+Shift+R.
nyssa closed this issue 2026-11-15 10:49:25 +00:00
Member

PR #215 merged into dev (merge commit 712dc6c5, fix commit 24038b45): crates/server/src/http.rs sets Cache-Control: no-cache on index.html (direct and SPA fallback) and public, max-age=31536000, immutable on /assets/*. Tests cover all three cases on router_with_panel. CI was fully green before merge.

PR #215 merged into dev (merge commit 712dc6c5, fix commit 24038b45): crates/server/src/http.rs sets Cache-Control: no-cache on index.html (direct and SPA fallback) and public, max-age=31536000, immutable on /assets/*. Tests cover all three cases on router_with_panel. CI was fully green before merge.
Sign in to join this conversation.
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Grimoirix/grimoire-of-digital-signage#205
No description provided.