Merge pull request #438 from prymitive/max-age

chore(backend): bump caching headers to 1 year
This commit is contained in:
Łukasz Mierzwa
2019-02-12 07:45:55 +00:00
committed by GitHub

View File

@@ -93,8 +93,8 @@ func serveFileOr404(path string, contentType string, c *gin.Context) {
func staticHeaders(prefix string) gin.HandlerFunc {
return func(c *gin.Context) {
if strings.HasPrefix(c.Request.URL.Path, prefix) {
c.Header("Cache-Control", "public, max-age=2592000")
expiresTime := time.Now().AddDate(0, 0, 30).Format(http.TimeFormat)
c.Header("Cache-Control", "public, max-age=31536000")
expiresTime := time.Now().AddDate(0, 0, 365).Format(http.TimeFormat)
c.Header("Expires", expiresTime)
}
}