Force web asset re-validation (on last modification date)

This commit is contained in:
Benedikt Kulmann
2020-11-23 13:16:49 +01:00
parent 005825bbc9
commit 5de15f4d12
2 changed files with 2 additions and 2 deletions

View File

@@ -169,7 +169,7 @@ func (p Phoenix) Static(ttl int) http.HandlerFunc {
return
}
w.Header().Set("Cache-Control", fmt.Sprintf("max-age=%s", strconv.Itoa(ttl)))
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)

View File

@@ -31,7 +31,7 @@ func Static(root string, fs http.FileSystem, ttl int) func(http.Handler) http.Ha
if strings.HasPrefix(r.URL.Path, path.Join(root, "api")) {
next.ServeHTTP(w, r)
} else {
w.Header().Set("Cache-Control", fmt.Sprintf("max-age=%s", strconv.Itoa(ttl)))
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)
static.ServeHTTP(w, r)