Setup cache headers for photo routes

This commit is contained in:
viktorstrate
2020-09-30 14:08:30 +02:00
parent bba82538fc
commit 4fe0608194
2 changed files with 8 additions and 4 deletions

View File

@@ -103,6 +103,9 @@ func RegisterPhotoRoutes(db *sql.DB, router *mux.Router) {
w.Header().Set("Content-Length", fmt.Sprintf("%d", stats.Size()))
}
// Allow caching the resource for 1 day
w.Header().Set("Cache-Control", "private, max-age=86400, immutable")
io.Copy(w, file)
})
}