summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/caddyhttp/reverseproxy/reverseproxy.go7
1 files changed, 3 insertions, 4 deletions
diff --git a/modules/caddyhttp/reverseproxy/reverseproxy.go b/modules/caddyhttp/reverseproxy/reverseproxy.go
index 0b4bcdf..52d230c 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 {