summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/reverseproxy/reverseproxy.go
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2021-05-05 14:52:18 -0600
committerMatthew Holt <mholt@users.noreply.github.com>2021-05-05 14:52:24 -0600
commita17c3b568d635ea45deb204d06e251810e94a7d6 (patch)
tree1625eda0514d8924c4993303ee9a8f93c16e3455 /modules/caddyhttp/reverseproxy/reverseproxy.go
parent74f5d66c4826e177123859abae3981bd196bfdcf (diff)
reverseproxy: Minor logging improvements
Diffstat (limited to 'modules/caddyhttp/reverseproxy/reverseproxy.go')
-rw-r--r--modules/caddyhttp/reverseproxy/reverseproxy.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/modules/caddyhttp/reverseproxy/reverseproxy.go b/modules/caddyhttp/reverseproxy/reverseproxy.go
index b6c24f3..ddb3ca9 100644
--- a/modules/caddyhttp/reverseproxy/reverseproxy.go
+++ b/modules/caddyhttp/reverseproxy/reverseproxy.go
@@ -568,9 +568,11 @@ func (h *Handler) reverseProxy(rw http.ResponseWriter, req *http.Request, repl *
logger := h.logger.With(
zap.String("upstream", di.Upstream.String()),
zap.Object("request", caddyhttp.LoggableHTTPRequest{Request: req}),
- zap.Duration("duration", duration))
+ )
if err != nil {
- logger.Debug("upstream roundtrip", zap.Error(err))
+ logger.Debug("upstream roundtrip",
+ zap.Duration("duration", duration),
+ zap.Error(err))
return err
}
logger.Debug("upstream roundtrip",
@@ -642,7 +644,7 @@ func (h *Handler) reverseProxy(rw http.ResponseWriter, req *http.Request, repl *
// deal with 101 Switching Protocols responses: (WebSocket, h2c, etc)
if res.StatusCode == http.StatusSwitchingProtocols {
- h.handleUpgradeResponse(rw, req, res)
+ h.handleUpgradeResponse(logger, rw, req, res)
return nil
}