From 16d392ebeb41b0fbee5e00497d7567690a09075e Mon Sep 17 00:00:00 2001 From: mathieuHa Date: Sun, 27 Nov 2022 11:52:41 +0100 Subject: [PATCH] :bug: Revert condition of healthy stream in stream mode (#48) * :bug: Revert condition of healthy stream in stream mode * :loud_sound: Update logs format for error case * :recycle: Invest condition for is stream healthy --- bouncer.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bouncer.go b/bouncer.go index 5b0f01a..888b16d 100644 --- a/bouncer.go +++ b/bouncer.go @@ -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)