🔨 always set custom remediation header if configured for bans (#218)

This commit is contained in:
blotus
2025-02-17 14:02:21 +01:00
committed by GitHub
parent 4708d76854
commit e4c84409e7

View File

@@ -350,14 +350,14 @@ type Login struct {
// To append Headers we need to call rw.WriteHeader after set any header.
func handleBanServeHTTP(bouncer *Bouncer, rw http.ResponseWriter) {
if bouncer.remediationCustomHeader != "" {
rw.Header().Set(bouncer.remediationCustomHeader, "ban")
}
if bouncer.banTemplateString == "" {
rw.WriteHeader(http.StatusForbidden)
return
}
rw.Header().Set("Content-Type", "text/html; charset=utf-8")
if bouncer.remediationCustomHeader != "" {
rw.Header().Set(bouncer.remediationCustomHeader, "ban")
}
rw.WriteHeader(http.StatusForbidden)
_, err := fmt.Fprint(rw, bouncer.banTemplateString)
if err != nil {