summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/caddyhttp/caddyhttp.go8
-rw-r--r--modules/caddyhttp/server.go4
2 files changed, 7 insertions, 5 deletions
diff --git a/modules/caddyhttp/caddyhttp.go b/modules/caddyhttp/caddyhttp.go
index aae65ab..1f16339 100644
--- a/modules/caddyhttp/caddyhttp.go
+++ b/modules/caddyhttp/caddyhttp.go
@@ -479,9 +479,11 @@ func (app *App) automaticHTTPS() error {
// rest of the redirects
if len(redirServerAddrs) > 0 {
app.Servers["remaining_auto_https_redirects"] = &Server{
- Listen: redirServerAddrs,
- Routes: redirRoutes,
- tlsApp: tlsApp, // required to solve HTTP challenge
+ Listen: redirServerAddrs,
+ Routes: redirRoutes,
+ tlsApp: tlsApp, // required to solve HTTP challenge
+ logger: app.logger.Named("log"),
+ errorLogger: app.logger.Named("log.error"),
}
}
}
diff --git a/modules/caddyhttp/server.go b/modules/caddyhttp/server.go
index 255b996..d01eaed 100644
--- a/modules/caddyhttp/server.go
+++ b/modules/caddyhttp/server.go
@@ -91,7 +91,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
zap.Object("request", loggableReq),
)
- if s.Logs != nil {
+ if s.accessLogger != nil {
wrec := NewResponseRecorder(w, nil, nil)
w = wrec
accLog := s.accessLogger.With(
@@ -107,7 +107,7 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
repl.Set("http.response.latency", latency.String())
logger := accLog
- if s.Logs.LoggerNames != nil {
+ if s.Logs != nil && s.Logs.LoggerNames != nil {
logger = logger.Named(s.Logs.LoggerNames[r.Host])
}