mirror of
https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin.git
synced 2026-07-20 11:09:00 +02:00
🐛 Revert condition of healthy stream in stream mode (#48)
* 🐛 Revert condition of healthy stream in stream mode * 🔊 Update logs format for error case * ♻️ Invest condition for is stream healthy
This commit is contained in:
+3
-3
@@ -194,15 +194,15 @@ func (bouncer *Bouncer) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
||||
// Right here if we cannot join the stream we forbid the request to go on.
|
||||
if bouncer.crowdsecMode == streamMode {
|
||||
if isCrowdsecStreamHealthy {
|
||||
bouncer.next.ServeHTTP(rw, req)
|
||||
} else {
|
||||
logger.Error(fmt.Sprintf("ServeHTTP:isCrowdsecStreamHealthy ip:%s", remoteIP))
|
||||
rw.WriteHeader(http.StatusForbidden)
|
||||
} else {
|
||||
bouncer.next.ServeHTTP(rw, req)
|
||||
}
|
||||
} else {
|
||||
err = handleNoStreamCache(bouncer, remoteIP)
|
||||
if err != nil {
|
||||
logger.Debug(err.Error())
|
||||
logger.Debug(fmt.Sprintf("ServeHTTP:handleNoStreamCache ip:%s %s", remoteIP, err.Error()))
|
||||
rw.WriteHeader(http.StatusForbidden)
|
||||
} else {
|
||||
bouncer.next.ServeHTTP(rw, req)
|
||||
|
||||
Reference in New Issue
Block a user