Skip to content

Commit

Permalink
reverseproxy: Err 503 if all upstreams unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
mholt committed Jul 8, 2022
1 parent 54d1923 commit d6bc9e0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/caddyhttp/reverseproxy/reverseproxy.go
Expand Up @@ -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
Expand Down

0 comments on commit d6bc9e0

Please sign in to comment.