disable-cache.go 287 B

123456789101112
  1. package middleware
  2. import "github.com/gin-gonic/gin"
  3. func DisableCache() gin.HandlerFunc {
  4. return func(c *gin.Context) {
  5. c.Header("Cache-Control", "no-store, no-cache, must-revalidate, private, max-age=0")
  6. c.Header("Pragma", "no-cache")
  7. c.Header("Expires", "0")
  8. c.Next()
  9. }
  10. }