Archived
Template
1
0

Initial commit

This commit is contained in:
uberswe
2021-12-12 14:56:13 +01:00
commit 0511f8fbca
1627 changed files with 773292 additions and 0 deletions

19
middleware/general.go Normal file
View File

@ -0,0 +1,19 @@
package middleware
import (
"github.com/gin-gonic/gin"
"os"
)
// General handles the default headers that should be present in every response
func General() gin.HandlerFunc {
return func(c *gin.Context) {
c.Header("X-Content-Type-Options", "nosniff")
c.Header("X-XSS-Protection", "1; mode=block")
c.Header("X-Frame-Options", "DENY")
if os.Getenv("STRICT_TRANSPORT_SECURITY") == "true" {
c.Header("Strict-Transport-Security", "max-age=63072000; includeSubDomains; preload;")
}
c.Next()
}
}