Set X-Frame-Options: DENY

This commit is contained in:
perennial
2024-02-20 17:51:44 +11:00
parent c5553fe953
commit 440aaa045d
+3 -2
View File
@@ -137,12 +137,13 @@ func main() {
// Global HTTP headers
server.Use(func(c *fiber.Ctx) error {
c.Set("X-Frame-Options", "SAMEORIGIN")
c.Set("X-Frame-Options", "DENY")
// use this if need iframe: `X-Frame-Options: SAMEORIGIN`
c.Set("X-Content-Type-Options", "nosniff")
c.Set("Referrer-Policy", "no-referrer")
c.Set("Strict-Transport-Security", "max-age=31536000; includeSubDomains; preload")
c.Set("Content-Security-Policy", fmt.Sprintf("default-src 'none'; script-src 'self'; style-src 'self'; img-src 'self' %s; connect-src 'self'; form-action 'self'; frame-ancestors 'none'; ", config.GetImageProxyOrigin(c)))
// use this if need iframe: frame-ancestors 'self'
// use this if need iframe: `frame-ancestors 'self'`
return c.Next()
})