Skip to content

Commit

Permalink
Merge branch 'main' into auth-expire-self
Browse files Browse the repository at this point in the history
  • Loading branch information
markphelps authored Jan 20, 2023
2 parents b78d2c0 + 4902107 commit eb774b9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/cmd/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ func NewHTTPServer(
r.Group(func(r chi.Router) {
r.Use(func(handler http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("X-CSRF-Token", csrf.Token(r))
if cfg.Authentication.Session.CSRF.Key != "" {
w.Header().Set("X-CSRF-Token", csrf.Token(r))
}

handler.ServeHTTP(w, r)
})
Expand Down

0 comments on commit eb774b9

Please sign in to comment.