package middleware import ( "strings" "github.com/gin-gonic/gin" ) // StaticCache sets Cache-Control headers for static assets (/static/*). // 1-hour cache allows browsers to reuse JS/CSS across page navigations // without re-downloading on every request. func StaticCache() gin.HandlerFunc { return func(c *gin.Context) { if strings.HasPrefix(c.Request.URL.Path, "/static/") { c.Header("Cache-Control", "public, max-age=3600") } c.Next() } }