From a0519784edf9ef09d0455e31366d952c7dabe213 Mon Sep 17 00:00:00 2001 From: whoswhip Date: Fri, 13 Nov 2026 13:17:35 -0500 Subject: [PATCH] improve content caching header + csp --- handlers.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/handlers.go b/handlers.go index 5a58e50..f655a29 100644 --- a/handlers.go +++ b/handlers.go @@ -316,6 +316,8 @@ func contentHandler(db *gorm.DB, cfg Config) http.HandlerFunc { } w.Header().Set("Cache-Control", fmt.Sprintf("public, max-age=%d, must-revalidate", ttl)) + w.Header().Set("ETag", "\""+hex.EncodeToString(upload.SHA256)+"\"") + w.Header().Set("Content-Security-Policy", "sandbox") w.Header().Set("Content-Type", upload.MIMEType) w.Header().Set("X-Content-Type-Options", "nosniff") http.ServeContent(w, r, upload.Filename, time.Unix(upload.CreatedAt, 0), file)