summaryrefslogtreecommitdiff
path: root/internal/web/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/web/server.go')
-rw-r--r--internal/web/server.go12
1 files changed, 11 insertions, 1 deletions
diff --git a/internal/web/server.go b/internal/web/server.go
index 50bf45d..10401ed 100644
--- a/internal/web/server.go
+++ b/internal/web/server.go
@@ -46,7 +46,17 @@ func NewServer(cfg config.Config) http.Handler {
}
mux.Handle("GET /static/", http.StripPrefix("/static/", http.FileServer(http.FS(staticSub))))
- return mux
+ return noStore(mux)
+}
+
+// noStore stops the browser caching any lectio-web response, so a rebuilt or
+// reinstalled server never has an old page, base.css or theme.css served from
+// cache (which presents as "switching themes stopped working" after an update).
+func noStore(h http.Handler) http.Handler {
+ return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
+ w.Header().Set("Cache-Control", "no-store")
+ h.ServeHTTP(w, r)
+ })
}
// today is lectio-web's "no ?date=" default, in the YYYY-MM-DD form every