Implement handling of error unauthorized by client forwarding request to remote tcp service. Bubble this up as a 401 to the caller
@@ -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)
}
