improve content caching header + csp
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user