improve content caching header + csp

This commit is contained in:
2026-11-13 13:17:35 -05:00
parent 979970aa0d
commit a0519784ed
+2
View File
@@ -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("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("Content-Type", upload.MIMEType)
w.Header().Set("X-Content-Type-Options", "nosniff") w.Header().Set("X-Content-Type-Options", "nosniff")
http.ServeContent(w, r, upload.Filename, time.Unix(upload.CreatedAt, 0), file) http.ServeContent(w, r, upload.Filename, time.Unix(upload.CreatedAt, 0), file)