caddyhttp: Fix logging on wildcard sites when SkipUnmappedHosts is true (#7372)

This commit is contained in:
Francis Lavoie 2025-12-03 13:46:11 -05:00 committed by GitHub
parent 7ebe72bbfe
commit be5f49fbeb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -763,9 +763,11 @@ func (s *Server) shouldLogRequest(r *http.Request) bool {
hostWithoutPort = r.Host
}
if _, ok := s.Logs.LoggerNames[hostWithoutPort]; ok {
// this host is mapped to a particular logger name
return true
for loggerName := range s.Logs.LoggerNames {
if certmagic.MatchWildcard(hostWithoutPort, loggerName) {
// this host is mapped to a particular logger name
return true
}
}
for _, dh := range s.Logs.SkipHosts {
// logging for this particular host is disabled