Skip to content

Commit be5f49f

Browse files
caddyhttp: Fix logging on wildcard sites when SkipUnmappedHosts is true (#7372)
1 parent 7ebe72b commit be5f49f

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

modules/caddyhttp/server.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -763,9 +763,11 @@ func (s *Server) shouldLogRequest(r *http.Request) bool {
763763
hostWithoutPort = r.Host
764764
}
765765

766-
if _, ok := s.Logs.LoggerNames[hostWithoutPort]; ok {
767-
// this host is mapped to a particular logger name
768-
return true
766+
for loggerName := range s.Logs.LoggerNames {
767+
if certmagic.MatchWildcard(hostWithoutPort, loggerName) {
768+
// this host is mapped to a particular logger name
769+
return true
770+
}
769771
}
770772
for _, dh := range s.Logs.SkipHosts {
771773
// logging for this particular host is disabled

0 commit comments

Comments
 (0)