server: add "Cache-Control: max-age=0" response header
This commit is contained in:
parent
03608cb46e
commit
5f4ebeba95
@ -1092,6 +1092,13 @@ func allowedHostsMiddleware(addr net.Addr) gin.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
func CacheControlMiddleware() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
c.Header("Cache-Control", "max-age=0")
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) GenerateRoutes() http.Handler {
|
||||
config := cors.DefaultConfig()
|
||||
config.AllowWildcard = true
|
||||
@ -1105,6 +1112,7 @@ func (s *Server) GenerateRoutes() http.Handler {
|
||||
|
||||
r := gin.Default()
|
||||
r.Use(
|
||||
CacheControlMiddleware(),
|
||||
cors.New(config),
|
||||
allowedHostsMiddleware(s.addr),
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user