Skip to content

Commit 54f75d4

Browse files
authored
fail 404s on JS healthcheck
1 parent 508b705 commit 54f75d4

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ services:
8282
--providers.docker=true
8383
--providers.docker.network=default
8484
--experimental.plugins.captcha-protect.modulename=github.com/libops/captcha-protect
85-
--experimental.plugins.captcha-protect.version=v1.11.0
85+
--experimental.plugins.captcha-protect.version=v1.11.1
8686
volumes:
8787
- /var/run/docker.sock:/var/run/docker.sock:z
8888
- /CHANGEME/TO/A/HOST/PATH/FOR/STATE/FILE:/tmp/state.json:rw
@@ -136,7 +136,7 @@ The circuit breaker provides automatic failover when the primary captcha provide
136136

137137
1. **Enables a liveness probe on the captcha provider**: Periodically sends HEAD requests to the provider's JavaScript file (every `periodSeconds`, default 30s). Also records 5xx errors during server side validation.
138138
2. **Detects failures**: Counts consecutive health check failures
139-
3. **Opens circuit**: After `failureThreshold` consecutive failures (default 3), switches to proof-of-javascript fallback
139+
3. **Opens circuit**: After `failureThreshold` consecutive failures, switches to proof-of-javascript fallback
140140
4. **Falls back to PoJ**: Ensures user is loading javascript. Requires revalidating in 1hr
141141
5. **Auto-recovery**: Automatically returns to primary provider when health checks succeed
142142

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ func (bc *CaptchaProtect) performHealthCheck() {
426426
}
427427
defer resp.Body.Close()
428428

429-
if resp.StatusCode >= 200 && resp.StatusCode < 500 {
429+
if resp.StatusCode != http.StatusNotFound && resp.StatusCode >= 200 && resp.StatusCode < 500 {
430430
bc.recordHealthCheckSuccess()
431431
return
432432
}

0 commit comments

Comments
 (0)