mirror of
https://github.com/caddyserver/caddy.git
synced 2025-01-27 23:03:37 -05:00
reverseproxy: Emit debug log before checking error (#3425)
This way the upstream request will always be available even if it failed
This commit is contained in:
parent
c47ddbeffb
commit
812278acd8
1 changed files with 3 additions and 4 deletions
|
@ -465,10 +465,6 @@ func (h *Handler) reverseProxy(rw http.ResponseWriter, req *http.Request, di Dia
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
res, err := h.Transport.RoundTrip(req)
|
res, err := h.Transport.RoundTrip(req)
|
||||||
duration := time.Since(start)
|
duration := time.Since(start)
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
h.logger.Debug("upstream roundtrip",
|
h.logger.Debug("upstream roundtrip",
|
||||||
zap.String("upstream", di.Upstream.String()),
|
zap.String("upstream", di.Upstream.String()),
|
||||||
zap.Object("request", caddyhttp.LoggableHTTPRequest{Request: req}),
|
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.Duration("duration", duration),
|
||||||
zap.Int("status", res.StatusCode),
|
zap.Int("status", res.StatusCode),
|
||||||
)
|
)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// update circuit breaker on current conditions
|
// update circuit breaker on current conditions
|
||||||
if di.Upstream.cb != nil {
|
if di.Upstream.cb != nil {
|
||||||
|
|
Loading…
Add table
Reference in a new issue