From b96113a4e9155ece4c0ecee493140f753d220d77 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 8 Oct 2026 10:55:25 +0900 Subject: [PATCH] Web UI: no-cache on every static file, so an upgrade is not hidden by the browser cache Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01XEUxFQp8ivofZLm1o6KiXm --- CHANGELOG.md | 6 ++++++ internal/api/server.go | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f28dab6..1a6b3ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,12 @@ The release notes on GitHub are taken from this file: the section whose heading is the version number. +## 1.5.1 + +- The web UI's scripts and styles are no longer kept by the browser across + an upgrade: after replacing the program, a normal reload shows the new + pages (before, an old app.js could stay in the browser's cache). + ## 1.5.0 Includes the changes listed under 1.2.3: the 1.2.3 release was built from diff --git a/internal/api/server.go b/internal/api/server.go index aed47f8..6a1d826 100644 --- a/internal/api/server.go +++ b/internal/api/server.go @@ -122,9 +122,10 @@ func (s *Server) Handler() http.Handler { mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { w.Header().Set("X-Content-Type-Options", "nosniff") w.Header().Set("Referrer-Policy", "no-referrer") - if r.URL.Path == "/" || r.URL.Path == "/index.html" { - w.Header().Set("Cache-Control", "no-cache") - } + // no-cache on every file: after an upgrade the browser must not keep + // the old app.js or app.css (the embedded files carry no date to + // revalidate against, so a cached copy could outlive the program) + w.Header().Set("Cache-Control", "no-cache") static.ServeHTTP(w, r) }) return mux