diff options
author | Matthew Holt <[email protected]> | 2020-05-18 13:50:40 -0600 |
---|---|---|
committer | Matthew Holt <[email protected]> | 2020-05-18 13:50:46 -0600 |
commit | 812278acd8a5c46b44fdf92ea5df4d6a51eff7be (patch) | |
tree | b3f740a1e8c6490a373236ada70497415cd2e15f /modules | |
parent | c47ddbeffb0457d4ac7f65d89f77abae817df239 (diff) | |
download | caddy-812278acd8a5c46b44fdf92ea5df4d6a51eff7be.tar.gz caddy-812278acd8a5c46b44fdf92ea5df4d6a51eff7be.zip |
reverseproxy: Emit debug log before checking error (#3425)
This way the upstream request will always be available even if it failed
Diffstat (limited to 'modules')
-rw-r--r-- | modules/caddyhttp/reverseproxy/reverseproxy.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/modules/caddyhttp/reverseproxy/reverseproxy.go b/modules/caddyhttp/reverseproxy/reverseproxy.go index 0b4bcdfbc..52d230c72 100644 --- a/modules/caddyhttp/reverseproxy/reverseproxy.go +++ b/modules/caddyhttp/reverseproxy/reverseproxy.go @@ -465,10 +465,6 @@ func (h *Handler) reverseProxy(rw http.ResponseWriter, req *http.Request, di Dia start := time.Now() res, err := h.Transport.RoundTrip(req) duration := time.Since(start) - if err != nil { - return err - } - h.logger.Debug("upstream roundtrip", zap.String("upstream", di.Upstream.String()), zap.Object("request", caddyhttp.LoggableHTTPRequest{Request: req}), @@ -476,6 +472,9 @@ func (h *Handler) reverseProxy(rw http.ResponseWriter, req *http.Request, di Dia zap.Duration("duration", duration), zap.Int("status", res.StatusCode), ) + if err != nil { + return err + } // update circuit breaker on current conditions if di.Upstream.cb != nil { |