feat(security): enable Content-Security-Plolicy #263
This commit was merged in pull request #265.
This commit is contained in:
11
middleware/content_security_policiy.go
Normal file
11
middleware/content_security_policiy.go
Normal file
@@ -0,0 +1,11 @@
|
||||
package middleware
|
||||
|
||||
import "net/http"
|
||||
|
||||
func ContentSecurityPolicy(next http.Handler) http.Handler {
|
||||
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Security-Policy", "default-src 'self'")
|
||||
next.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user