Skip to content

Commit 889c5b5

Browse files
authored
✨ Add solved-captcha as option of remediationCustomHeader (#310)
1 parent efb3a67 commit 889c5b5

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ make run
420420
- RemediationHeadersCustomName
421421
- string
422422
- default: ""
423-
- Name of the header you want in response when request are cancelled (possible value of the header `ban` or `captcha`)
423+
- Name of the header you want in response when request are handled by plugin (possible value of the header `ban`, `captcha` or `solved-captcha`)
424424
- ForwardedHeadersCustomName
425425
- string
426426
- default: "X-Forwarded-For"

pkg/captcha/captcha.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ func (c *Client) ServeHTTP(rw http.ResponseWriter, r *http.Request, remoteIP str
9494
if valid {
9595
c.log.Debug("captcha:ServeHTTP captcha:valid")
9696
c.cacheClient.Set(remoteIP+"_captcha", cache.CaptchaDoneValue, c.gracePeriodSeconds)
97+
if c.remediationCustomHeader != "" {
98+
rw.Header().Set(c.remediationCustomHeader, "solved-captcha")
99+
}
97100
http.Redirect(rw, r, r.URL.String(), http.StatusFound)
98101
return
99102
}

0 commit comments

Comments
 (0)