Archived
Template
1
0

Adds a cache max age parameter and fixes cache parameter for main.js

Fixed throttling
This commit is contained in:
uberswe
2022-01-09 12:11:54 +01:00
parent 559059f54e
commit 3f3b2338d6
7 changed files with 26 additions and 16 deletions

View File

@ -1,10 +1,13 @@
package middleware
import "github.com/gin-gonic/gin"
import (
"fmt"
"github.com/gin-gonic/gin"
)
func Cache() gin.HandlerFunc {
func Cache(maxAge int) gin.HandlerFunc {
return func(c *gin.Context) {
c.Header("Cache-Control", "public, max-age=60")
c.Header("Cache-Control", fmt.Sprintf("public, max-age=%d", maxAge))
c.Next()
}
}