aboutsummaryrefslogtreecommitdiffhomepage
path: root/modules/caddyhttp/ip_matchers.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddyhttp/ip_matchers.go')
-rw-r--r--modules/caddyhttp/ip_matchers.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/caddyhttp/ip_matchers.go b/modules/caddyhttp/ip_matchers.go
index 2e735cb69..99eb39dff 100644
--- a/modules/caddyhttp/ip_matchers.go
+++ b/modules/caddyhttp/ip_matchers.go
@@ -26,6 +26,7 @@ import (
"github.com/google/cel-go/cel"
"github.com/google/cel-go/common/types/ref"
"go.uber.org/zap"
+ "go.uber.org/zap/zapcore"
"github.com/caddyserver/caddy/v2"
"github.com/caddyserver/caddy/v2/caddyconfig/caddyfile"
@@ -150,12 +151,17 @@ func (m MatchRemoteIP) Match(r *http.Request) bool {
address := r.RemoteAddr
clientIP, zoneID, err := parseIPZoneFromString(address)
if err != nil {
- m.logger.Error("getting remote IP", zap.Error(err))
+ if c := m.logger.Check(zapcore.ErrorLevel, "getting remote "); c != nil {
+ c.Write(zap.Error(err))
+ }
+
return false
}
matches, zoneFilter := matchIPByCidrZones(clientIP, zoneID, m.cidrs, m.zones)
if !matches && !zoneFilter {
- m.logger.Debug("zone ID from remote IP did not match", zap.String("zone", zoneID))
+ if c := m.logger.Check(zapcore.DebugLevel, "zone ID from remote IP did not match"); c != nil {
+ c.Write(zap.String("zone", zoneID))
+ }
}
return matches
}