Skip to content
Permalink
Browse files Browse the repository at this point in the history
chore: add Content-Security-Policy header
  • Loading branch information
o1egl committed Jul 26, 2021
1 parent f2b5dd3 commit 201329a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions http/http.go
Expand Up @@ -25,6 +25,12 @@ func NewHandler(
server.Clean()

r := mux.NewRouter()
r.Use(func(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)
})
})
index, static := getStaticHandlers(store, server, assetsFs)

// NOTE: This fixes the issue where it would redirect if people did not put a
Expand Down

0 comments on commit 201329a

Please sign in to comment.