Feat: static files cache header

pull/21/head
zijiren233 1 year ago
parent 9aa6198864
commit 1669751931

@ -40,6 +40,15 @@ func Init(e *gin.Engine, s *rtmps.Server) {
{
web := e.Group("/web")
web.Use(func(ctx *gin.Context) {
if ctx.Request.URL.Path == "/web/" {
ctx.Header("Cache-Control", "no-store")
} else {
ctx.Header("Cache-Control", "public, max-age=31536000")
}
ctx.Next()
})
web.StaticFS("", http.FS(public.Public))
}

@ -11,7 +11,7 @@ func Init(e *gin.Engine) {
e.
Use(gin.LoggerWithWriter(w), gin.RecoveryWithWriter(w)).
Use(NewCors())
if conf.Conf.Server.Quic {
if conf.Conf.Server.Quic && conf.Conf.Server.CertPath != "" && conf.Conf.Server.KeyPath != "" {
e.Use(NewQuic())
}
}

Loading…
Cancel
Save