mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-12-22 10:12:11 +00:00
[performance] Add long cache-control max age to fileserver (#710)
This commit is contained in:
parent
1d5c737bbb
commit
839c4346ad
|
@ -107,5 +107,11 @@ func (m *FileServer) ServeFile(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
c.DataFromReader(http.StatusOK, content.ContentLength, format, content.Content, nil)
|
||||
c.DataFromReader(http.StatusOK, content.ContentLength, format, content.Content, map[string]string{
|
||||
// since we'll never host different files at the same
|
||||
// URL (bc the ULIDs are generated per piece of media),
|
||||
// it's sensible and safe to use a long cache here, so
|
||||
// that clients don't keep fetching files over + over again
|
||||
"Cache-Control": "max-age=604800",
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue