enhanced CDN caching

This commit is contained in:
Martin Riedl 2021-03-18 18:32:47 +01:00
parent b312a51c62
commit dd14b201b1
Signed by: martinr92
GPG key ID: FB68DA65516A804C

4
fs.go
View file

@ -138,9 +138,9 @@ func ContentTypeHeaderHandler(w http.ResponseWriter, r *http.Request, info Routi
}
}
// CacheControlHeaderHandler send cache control header of 7 days
// CacheControlHeaderHandler send cache control header of 7 days for the browser and 30 days for the CDN
func CacheControlHeaderHandler(w http.ResponseWriter, r *http.Request, info RoutingInfo, file fs.File) {
w.Header().Set("Cache-Control", fmt.Sprintf("public, max-age=%d", 60*60*24*7))
w.Header().Set("Cache-Control", fmt.Sprintf("public, s-maxage=%d, max-age=%d", 60*60*24*30, 60*60*24*7))
}
// ContentTypeOptionHeaderHandler for nosniff content type option