Skip to content

Commit

Permalink
fixed proxy error when no endpoints are available
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Oct 27, 2023
1 parent 1a7b740 commit fb26b95
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions proxy/beaconproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ func (proxy *BeaconProxy) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}

endpoint := proxy.pool.GetReadyEndpoint()
if endpoint == nil {
w.Header().Set("Content-Type", "text/html")
w.WriteHeader(http.StatusServiceUnavailable)
w.Write([]byte("No Endpoint available"))
return
}
err := proxy.processProxyCall(w, r, endpoint)

if err != nil {
Expand Down

0 comments on commit fb26b95

Please sign in to comment.