mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-01-23 22:58:42 +01: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
|
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 New Issue
Block a user