Merge pull request 'fix(server): Cache-Control no-cache for web assets (stop stale builds)' (#99) from fix/web-no-cache-headers into master
Build and Deploy / build-and-push (push) Successful in 5m58s
Web E2E / web-e2e (push) Failing after 5m4s

This commit was merged in pull request #99.
This commit is contained in:
2026-06-24 01:45:09 +00:00
+8
View File
@@ -267,6 +267,14 @@ async fn security_headers(req: Request<axum::body::Body>, next: axum_middleware:
HeaderValue::from_static("nosniff"), HeaderValue::from_static("nosniff"),
); );
headers.insert("X-Frame-Options", HeaderValue::from_static("DENY")); headers.insert("X-Frame-Options", HeaderValue::from_static("DENY"));
// Force revalidation of the web assets. The HTML pages are compiled into
// the binary via `include_str!` and the wasm-bindgen output (canvas.js,
// canvas_bg.wasm, solitaire_wasm.*) keeps fixed filenames that change in
// place on every deploy. Without this, browsers heuristically cache them
// and keep serving stale builds even after a hard reload. `no-cache` lets
// the browser keep a copy but revalidate first; ServeDir supplies
// Last-Modified/ETag so unchanged assets still return a cheap 304.
headers.insert("Cache-Control", HeaderValue::from_static("no-cache"));
res res
} }