mirror of
https://github.com/kataras/iris.git
synced 2025-02-02 15:30:36 +01:00
Merge pull request #1710 from tuhao1020/master
udpate modifyProxiedRequest
This commit is contained in:
commit
0fc80c6813
|
@ -22,6 +22,7 @@ import (
|
|||
func ProxyHandler(target *url.URL) *httputil.ReverseProxy {
|
||||
director := func(req *http.Request) {
|
||||
modifyProxiedRequest(req, target)
|
||||
req.Host = target.Host
|
||||
req.URL.Path = path.Join(target.Path, req.URL.Path)
|
||||
}
|
||||
|
||||
|
@ -40,7 +41,6 @@ func ProxyHandler(target *url.URL) *httputil.ReverseProxy {
|
|||
func modifyProxiedRequest(req *http.Request, target *url.URL) {
|
||||
req.URL.Scheme = target.Scheme
|
||||
req.URL.Host = target.Host
|
||||
req.Host = target.Host
|
||||
|
||||
if target.RawQuery == "" || req.URL.RawQuery == "" {
|
||||
req.URL.RawQuery = target.RawQuery + req.URL.RawQuery
|
||||
|
@ -72,6 +72,8 @@ func ProxyHandlerRemote(target *url.URL, insecureSkipVerify bool) *httputil.Reve
|
|||
} else {
|
||||
req.URL.Path = path.Join(target.Path, req.URL.Path)
|
||||
}
|
||||
|
||||
req.Host = target.Host
|
||||
}
|
||||
p := &httputil.ReverseProxy{Director: director}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user