remove spoof-able request header (#7103)
* remove spoof-able request header https://github.com/seaweedfs/seaweedfs/issues/7094#issuecomment-3158320497 * Update weed/security/guard.go Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -257,12 +257,6 @@ func (ms *MasterServer) proxyToLeader(f http.HandlerFunc) http.HandlerFunc {
|
||||
// proxy to leader
|
||||
glog.V(4).Infoln("proxying to leader", raftServerLeader)
|
||||
proxy := httputil.NewSingleHostReverseProxy(targetUrl)
|
||||
director := proxy.Director
|
||||
proxy.Director = func(req *http.Request) {
|
||||
actualHost := security.GetActualRemoteHost(req)
|
||||
req.Header.Set("HTTP_X_FORWARDED_FOR", actualHost)
|
||||
director(req)
|
||||
}
|
||||
proxy.Transport = util_http.GetGlobalHttpClient().GetClientTransport()
|
||||
proxy.ServeHTTP(w, r)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user