Skip to content

Commit

Permalink
Return 503 from proxy when no primary available (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
benbjohnson authored Aug 8, 2023
1 parent e007fd1 commit 08348be
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions http/proxy_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ func (s *ProxyServer) serveNonRead(w http.ResponseWriter, r *http.Request) {
// Look up the hostname of the primary. If there's no primary info then
// go ahead and send the request
if info == nil {
s.logf("proxy: %s %s: no primary available, proxying to target", r.Method, r.URL.Path)
s.proxyToTarget(w, r, false)
s.logf("proxy: %s %s: no primary available, returning 503", r.Method, r.URL.Path)
http.Error(w, "Proxy error: no primary available", http.StatusServiceUnavailable)
return
}

Expand Down

0 comments on commit 08348be

Please sign in to comment.