|
|
@@ -163,6 +163,12 @@ func excute(c Command, w *http.ResponseWriter, req *http.Request) {
|
|
|
return
|
|
|
}
|
|
|
} else {
|
|
|
+ // current no leader
|
|
|
+ if server.Leader() == "" {
|
|
|
+ (*w).WriteHeader(http.StatusInternalServerError)
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
// tell the client where is the leader
|
|
|
debug("Redirect to the leader %s", server.Leader())
|
|
|
|
|
|
@@ -176,7 +182,7 @@ func excute(c Command, w *http.ResponseWriter, req *http.Request) {
|
|
|
|
|
|
url := scheme + leaderClient() + path
|
|
|
|
|
|
- debug("redirect to ", url)
|
|
|
+ debug("redirect to %s", url)
|
|
|
http.Redirect(*w, req, url, http.StatusTemporaryRedirect)
|
|
|
return
|
|
|
}
|