From 889c5b55fe71234826aedb64b5e1c3075dfda137 Mon Sep 17 00:00:00 2001 From: maxlerebourg Date: Fri, 23 Jan 2026 11:36:32 +0100 Subject: [PATCH] =?UTF-8?q?=20=E2=9C=A8=20Add=20solved-captcha=20as=20opti?= =?UTF-8?q?on=20of=20remediationCustomHeader=20(#310)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- pkg/captcha/captcha.go | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) 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 }