don't cache the web index.html

This commit is contained in:
Willy Kloucek
2022-10-13 11:09:26 +02:00
committed by Florian Schade
parent 968d26f0d6
commit fbf1eeb4c5
+7
View File
@@ -152,6 +152,13 @@ func (p Web) Static(ttl int) http.HandlerFunc {
w.Header().Set("Cache-Control", fmt.Sprintf("max-age=%s, must-revalidate", strconv.Itoa(ttl)))
w.Header().Set("Expires", expires)
w.Header().Set("Last-Modified", lastModified)
if r.URL.Path == rootWithSlash || r.URL.Path == rootWithSlash+"index.html" {
w.Header().Set("Cache-Control", "no-cache")
} else {
w.Header().Set("Cache-Control", "must-revalidate")
}
w.Header().Set("SameSite", "Strict")
static.ServeHTTP(w, r)