Browse Source

Move the redirect url perfer to volume server's PublicUrl

pull/84/head
yourchanges 10 years ago
parent
commit
7e0c080581
  1. 6
      go/weed/weed_server/master_server_handlers_admin.go

6
go/weed/weed_server/master_server_handlers_admin.go

@ -122,7 +122,11 @@ func (ms *MasterServer) redirectHandler(w http.ResponseWriter, r *http.Request)
}
machines := ms.Topo.Lookup("", volumeId)
if machines != nil && len(machines) > 0 {
http.Redirect(w, r, "http://"+machines[0].Url()+r.URL.Path, http.StatusMovedPermanently)
url := machines[0].PublicUrl
if url == "" {
url = machines[0].Url()
}
http.Redirect(w, r, "http://"+url+r.URL.Path, http.StatusMovedPermanently)
} else {
writeJsonError(w, r, http.StatusNotFound, fmt.Errorf("volume id %d not found.", volumeId))
}

Loading…
Cancel
Save