Use no-store to fully disable browser caching on assets

This commit is contained in:
Ian Gulliver
2026-02-15 22:49:44 -08:00
parent 82e8263ffc
commit 1e82b02bac

View File

@@ -111,7 +111,7 @@ func envMap() map[string]string {
func serveHTML(name string) http.HandlerFunc { func serveHTML(name string) http.HandlerFunc {
t := htmlTemplates.Lookup(name) t := htmlTemplates.Lookup(name)
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "no-cache") w.Header().Set("Cache-Control", "no-store")
w.Header().Set("Content-Type", "text/html") w.Header().Set("Content-Type", "text/html")
t.Execute(w, templateData()) t.Execute(w, templateData())
} }
@@ -120,7 +120,7 @@ func serveHTML(name string) http.HandlerFunc {
func serveJS(name string) http.HandlerFunc { func serveJS(name string) http.HandlerFunc {
t := jsTemplates.Lookup(name) t := jsTemplates.Lookup(name)
return func(w http.ResponseWriter, r *http.Request) { return func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "no-cache") w.Header().Set("Cache-Control", "no-store")
w.Header().Set("Content-Type", "application/javascript") w.Header().Set("Content-Type", "application/javascript")
t.Execute(w, templateData()) t.Execute(w, templateData())
} }