summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2022-10-05 14:14:13 -0400
committerGitHub <noreply@github.com>2022-10-05 12:14:13 -0600
commit99ffe9338837eff80def7e5d51c2a0e02f56abdb (patch)
treef9168596a126540e9ab1a38ae79fb7359877e1d5 /modules
parente07a267276b9c00181c979ec65f26e25b8325beb (diff)
logging: Fix `skip_hosts` with wildcards (#5102)
Fix #4859
Diffstat (limited to 'modules')
-rw-r--r--modules/caddyhttp/server.go15
1 files changed, 6 insertions, 9 deletions
diff --git a/modules/caddyhttp/server.go b/modules/caddyhttp/server.go
index 4d47d26..60fc3c3 100644
--- a/modules/caddyhttp/server.go
+++ b/modules/caddyhttp/server.go
@@ -639,21 +639,18 @@ func (s *Server) shouldLogRequest(r *http.Request) bool {
// logging is disabled
return false
}
+ if _, ok := s.Logs.LoggerNames[r.Host]; ok {
+ // this host is mapped to a particular logger name
+ return true
+ }
for _, dh := range s.Logs.SkipHosts {
// logging for this particular host is disabled
if certmagic.MatchWildcard(r.Host, dh) {
return false
}
}
- if _, ok := s.Logs.LoggerNames[r.Host]; ok {
- // this host is mapped to a particular logger name
- return true
- }
- if s.Logs.SkipUnmappedHosts {
- // this host is not mapped and thus must not be logged
- return false
- }
- return true
+ // if configured, this host is not mapped and thus must not be logged
+ return !s.Logs.SkipUnmappedHosts
}
// protocol returns true if the protocol proto is configured/enabled.