1
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-16 21:56:40 -05:00

reverseproxy: Err 503 if all upstreams unavailable

This commit is contained in:
Matthew Holt 2022-07-08 13:01:02 -06:00
parent 54d1923ccb
commit d6bc9e0b5c
No known key found for this signature in database
GPG key ID: 2A349DD577D586A5

View file

@ -477,7 +477,7 @@ func (h *Handler) proxyLoopIteration(r *http.Request, origReq *http.Request, w h
upstream := h.LoadBalancing.SelectionPolicy.Select(upstreams, r, w) upstream := h.LoadBalancing.SelectionPolicy.Select(upstreams, r, w)
if upstream == nil { if upstream == nil {
if proxyErr == 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) { if !h.LoadBalancing.tryAgain(h.ctx, start, proxyErr, r) {
return true, proxyErr return true, proxyErr