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