mirror of
https://github.com/tgdrive/teldrive.git
synced 2025-01-10 01:02:01 +08:00
21 lines
539 B
Go
21 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"},
|
||
|
})
|
||
|
}
|