diff options
author | Matthew Holt <mholt@users.noreply.github.com> | 2022-07-08 13:01:02 -0600 |
---|---|---|
committer | Matthew Holt <mholt@users.noreply.github.com> | 2022-07-08 13:01:32 -0600 |
commit | d6bc9e0b5c748c999e30051bf04d622dbbb0a156 (patch) | |
tree | 18afbd70ce0cb793e270f8d0731962c7f98e79d8 /modules/caddyhttp | |
parent | 54d1923ccb03299aa92bf0ec3ba255e4c851a69e (diff) |
reverseproxy: Err 503 if all upstreams unavailable
Diffstat (limited to 'modules/caddyhttp')
-rw-r--r-- | modules/caddyhttp/reverseproxy/reverseproxy.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/caddyhttp/reverseproxy/reverseproxy.go b/modules/caddyhttp/reverseproxy/reverseproxy.go index 15e3104..64adce2 100644 --- a/modules/caddyhttp/reverseproxy/reverseproxy.go +++ b/modules/caddyhttp/reverseproxy/reverseproxy.go @@ -477,7 +477,7 @@ func (h *Handler) proxyLoopIteration(r *http.Request, origReq *http.Request, w h upstream := h.LoadBalancing.SelectionPolicy.Select(upstreams, r, w) if upstream == nil { if proxyErr == nil { - proxyErr = fmt.Errorf("no upstreams available") + proxyErr = caddyhttp.Error(http.StatusServiceUnavailable, fmt.Errorf("no upstreams available")) } if !h.LoadBalancing.tryAgain(h.ctx, start, proxyErr, r) { return true, proxyErr |