This repository has been archived on 2025-08-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
web-app-template/middleware/content_security_policiy.go
Tim Wundenberg 35fea60750
All checks were successful
Build Docker Image / Build-Docker-Image (push) Successful in 46s
Build and Push Docker Image / Build-And-Push-Docker-Image (push) Successful in 51s
feat(security): enable Content-Security-Plolicy for external js
2024-11-19 22:04:43 +01:00

13 lines
293 B
Go

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' https://umami.me-fit.eu")
next.ServeHTTP(w, r)
})
}