fix: health check treats 4xx as success (WAF reachable, just no index page)
This commit is contained in:
parent
6b199f27e4
commit
62d532e2ce
1 changed files with 12 additions and 10 deletions
|
|
@ -24,11 +24,13 @@ func startHealthCheck() {
|
||||||
breaker.RecordFailure()
|
breaker.RecordFailure()
|
||||||
} else {
|
} else {
|
||||||
resp.Body.Close()
|
resp.Body.Close()
|
||||||
if resp.StatusCode < 500 {
|
// Any response (2xx, 3xx, 4xx) means WAF is reachable.
|
||||||
breaker.RecordSuccess()
|
// Only 5xx or connection errors indicate the WAF is unhealthy.
|
||||||
} else {
|
if resp.StatusCode >= 500 {
|
||||||
log.Printf("WAF health check: status %d", resp.StatusCode)
|
log.Printf("WAF health check: status %d", resp.StatusCode)
|
||||||
breaker.RecordFailure()
|
breaker.RecordFailure()
|
||||||
|
} else {
|
||||||
|
breaker.RecordSuccess()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue