mirror of
https://github.com/maxlerebourg/crowdsec-bouncer-traefik-plugin.git
synced 2026-07-21 03:28:59 +02:00
✨ add a new mode to enable only appsec checking (#128)
* ✨ add a new mode to enable only appsec checking * 🍱 fix comments
This commit is contained in:
@@ -153,6 +153,9 @@ func New(ctx context.Context, next http.Handler, config *configuration.Config, n
|
||||
},
|
||||
cacheClient: &cache.Client{},
|
||||
}
|
||||
if config.CrowdsecMode == configuration.AppsecMode {
|
||||
return bouncer, nil
|
||||
}
|
||||
config.RedisCachePassword, _ = configuration.GetVariable(config, "RedisCachePassword")
|
||||
bouncer.cacheClient.New(
|
||||
config.RedisCacheEnabled,
|
||||
@@ -208,6 +211,11 @@ func (bouncer *Bouncer) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
if bouncer.crowdsecMode == configuration.AppsecMode {
|
||||
handleNextServeHTTP(bouncer, remoteIP, rw, req)
|
||||
return
|
||||
}
|
||||
|
||||
// TODO This should be simplified
|
||||
if bouncer.crowdsecMode != configuration.NoneMode {
|
||||
isBanned, cacheErr := bouncer.cacheClient.GetDecision(remoteIP)
|
||||
|
||||
Reference in New Issue
Block a user