You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
synctv/server/middlewares/distCacheControl.go

15 lines
333 B
Go

package middlewares
import "github.com/gin-gonic/gin"
func NewDistCacheControl(prefix string) gin.HandlerFunc {
return func(ctx *gin.Context) {
if ctx.Request.URL.Path == prefix {
ctx.Header("Cache-Control", "no-cache, max-age=300")
} else {
ctx.Header("Cache-Control", "public, max-age=31536000")
}
ctx.Next()
}
}