caddyhttp: Fix logging on wildcard sites when SkipUnmappedHosts is true

This commit is contained in:
Francis Lavoie 2025-11-28 22:54:18 -05:00
parent 67a9e0657e
commit b0db012532
No known key found for this signature in database
GPG key ID: 656DB341634BFCE1

View file

@ -763,10 +763,12 @@ func (s *Server) shouldLogRequest(r *http.Request) bool {
hostWithoutPort = r.Host
}
if _, ok := s.Logs.LoggerNames[hostWithoutPort]; ok {
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
if certmagic.MatchWildcard(hostWithoutPort, dh) {