diff --git a/README.md b/README.md index fdda774..1042ed6 100644 --- a/README.md +++ b/README.md @@ -420,7 +420,7 @@ make run - RemediationHeadersCustomName - string - default: "" - - Name of the header you want in response when request are cancelled (possible value of the header `ban` or `captcha`) + - Name of the header you want in response when request are handled by plugin (possible value of the header `ban`, `captcha` or `solved-captcha`) - ForwardedHeadersCustomName - string - default: "X-Forwarded-For" diff --git a/pkg/captcha/captcha.go b/pkg/captcha/captcha.go index 9170e1e..5686aaa 100644 --- a/pkg/captcha/captcha.go +++ b/pkg/captcha/captcha.go @@ -94,6 +94,9 @@ func (c *Client) ServeHTTP(rw http.ResponseWriter, r *http.Request, remoteIP str if valid { c.log.Debug("captcha:ServeHTTP captcha:valid") c.cacheClient.Set(remoteIP+"_captcha", cache.CaptchaDoneValue, c.gracePeriodSeconds) + if c.remediationCustomHeader != "" { + rw.Header().Set(c.remediationCustomHeader, "solved-captcha") + } http.Redirect(rw, r, r.URL.String(), http.StatusFound) return }