mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
use the origin scheme
This commit is contained in:
parent
fcb78ed5cb
commit
df2945c521
13
handlers.go
13
handlers.go
@ -4,7 +4,7 @@ import (
|
||||
"encoding/json"
|
||||
"github.com/xiangli-cmu/go-raft"
|
||||
"net/http"
|
||||
"fmt"
|
||||
//"fmt"
|
||||
"io/ioutil"
|
||||
//"bytes"
|
||||
"strconv"
|
||||
@ -157,8 +157,15 @@ func excute(c Command, w *http.ResponseWriter, req *http.Request) {
|
||||
debug("Redirect to the leader %s", server.Leader())
|
||||
|
||||
path := req.URL.Path
|
||||
url := "http://" + server.Leader() + path
|
||||
|
||||
|
||||
var scheme string
|
||||
|
||||
if scheme = req.URL.Scheme; scheme == "" {
|
||||
scheme = "http://"
|
||||
}
|
||||
|
||||
url := scheme + server.Leader() + path
|
||||
|
||||
debug("redirect to ", url)
|
||||
http.Redirect(*w, req, url, http.StatusTemporaryRedirect)
|
||||
return
|
||||
|
Loading…
x
Reference in New Issue
Block a user