diff --git a/http/service.go b/http/service.go index 757aae12..6aa58582 100644 --- a/http/service.go +++ b/http/service.go @@ -1103,6 +1103,10 @@ func (s *Service) execute(w http.ResponseWriter, r *http.Request) { } results, resultsErr = s.cluster.Execute(er, addr, username, password, timeout) + if resultsErr.Error() == "Unauthorized" { + http.Error(w, ErrLeaderNotFound.Error(), http.StatusUnauthorized) + return + } stats.Add(numRemoteExecutions, 1) w.Header().Add(ServedByHTTPHeader, addr) }