From dd14b201b1556dd3ed4f3b8df27fb9ee830f16fa Mon Sep 17 00:00:00 2001 From: Martin Riedl Date: Thu, 18 Mar 2021 18:32:47 +0100 Subject: [PATCH] enhanced CDN caching --- fs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs.go b/fs.go index 543a60f..d7f7ed6 100644 --- a/fs.go +++ b/fs.go @@ -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