diff --git a/handlers.go b/handlers.go index 3e7073629..ce6167ae1 100644 --- a/handlers.go +++ b/handlers.go @@ -144,7 +144,8 @@ func excute(c Command, w *http.ResponseWriter) { } } else { // tell the client where is the leader - (*w).WriteHeader(http.StatusTemporaryRedirect) + debug("Redirect to the leader %s", server.Leader()) + (*w).WriteHeader(http.StatusServiceUnavailable) (*w).Write([]byte(server.Leader())) return } diff --git a/raftd.go b/raftd.go index ae9681268..6778acc69 100644 --- a/raftd.go +++ b/raftd.go @@ -379,7 +379,7 @@ func Join(s *raft.Server, serverName string) error { if resp.StatusCode == http.StatusOK { return nil } - if resp.StatusCode == http.StatusTemporaryRedirect { + if resp.StatusCode == http.StatusServiceUnavailable { address, err := ioutil.ReadAll(resp.Body) if err != nil { warn("Cannot Read Leader info: %v", err)