diff options
author | Francis Lavoie <[email protected]> | 2022-09-01 23:31:54 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2022-09-01 23:31:54 -0400 |
commit | d062fb40201b321c492da9b50ab8d107e0bb3c5f (patch) | |
tree | 3142f460a305746f80947962633e8402d1e3689d /modules/caddyhttp/autohttps.go | |
parent | 73d4a8ba02292491fca289b324e89ef8c62fd435 (diff) | |
download | caddy-d062fb40201b321c492da9b50ab8d107e0bb3c5f.tar.gz caddy-d062fb40201b321c492da9b50ab8d107e0bb3c5f.zip |
caddyhttp: Copy logger config to HTTP server during AutoHTTPS (#4990)
Diffstat (limited to 'modules/caddyhttp/autohttps.go')
-rw-r--r-- | modules/caddyhttp/autohttps.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/modules/caddyhttp/autohttps.go b/modules/caddyhttp/autohttps.go index 4cc5d2f2d..70f999b04 100644 --- a/modules/caddyhttp/autohttps.go +++ b/modules/caddyhttp/autohttps.go @@ -93,6 +93,9 @@ func (app *App) automaticHTTPSPhase1(ctx caddy.Context, repl *caddy.Replacer) er // https://github.com/caddyserver/caddy/issues/3443) redirDomains := make(map[string][]caddy.NetworkAddress) + // the configured logger for an HTTPS enabled server + var logger *ServerLogConfig + for srvName, srv := range app.Servers { // as a prerequisite, provision route matchers; this is // required for all routes on all servers, and must be @@ -172,6 +175,11 @@ func (app *App) automaticHTTPSPhase1(ctx caddy.Context, repl *caddy.Replacer) er continue } + // clone the logger so we can apply it to the HTTP server + if srv.Logs != nil { + logger = srv.Logs.clone() + } + // for all the hostnames we found, filter them so we have // a deduplicated list of names for which to obtain certs // (only if cert management not disabled for this server) @@ -400,6 +408,7 @@ redirServersLoop: app.Servers["remaining_auto_https_redirects"] = &Server{ Listen: redirServerAddrsList, Routes: appendCatchAll(redirRoutes), + Logs: logger, } } |