From be5f49fbeb046fb123583e5887ddf576a312a8e4 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Wed, 3 Dec 2025 13:46:11 -0500 Subject: [PATCH] caddyhttp: Fix logging on wildcard sites when SkipUnmappedHosts is true (#7372) --- modules/caddyhttp/server.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/caddyhttp/server.go b/modules/caddyhttp/server.go index 94b8febfa..49aa3a730 100644 --- a/modules/caddyhttp/server.go +++ b/modules/caddyhttp/server.go @@ -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