mirror of
https://github.com/tgdrive/teldrive.git
synced 2025-01-09 16:49:51 +08:00
20 lines
539 B
Go
20 lines
539 B
Go
package middleware
|
|
|
|
import (
|
|
"github.com/gin-contrib/secure"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func Security() gin.HandlerFunc {
|
|
return secure.New(secure.Config{
|
|
STSSeconds: 315360000,
|
|
STSIncludeSubdomains: true,
|
|
FrameDeny: true,
|
|
ContentTypeNosniff: true,
|
|
BrowserXssFilter: true,
|
|
ContentSecurityPolicy: "default-src 'self'",
|
|
IENoOpen: true,
|
|
ReferrerPolicy: "strict-origin-when-cross-origin",
|
|
SSLProxyHeaders: map[string]string{"X-Forwarded-Proto": "https"},
|
|
})
|
|
}
|