Forráskód Böngészése

auto update script executed

Toby Chui 1 éve
szülő
commit
ca6699612d
1 módosított fájl, 2 hozzáadás és 2 törlés
  1. 2 2
      mod/dynamicproxy/dpcore/dpcore.go

+ 2 - 2
mod/dynamicproxy/dpcore/dpcore.go

@@ -238,6 +238,8 @@ func (p *ReverseProxy) ProxyHTTP(rw http.ResponseWriter, req *http.Request, rrr
 		transport = http.DefaultTransport
 		transport = http.DefaultTransport
 	}
 	}
 
 
+	hostname := req.Host
+
 	outreq := new(http.Request)
 	outreq := new(http.Request)
 	// Shallow copies of maps, like header
 	// Shallow copies of maps, like header
 	*outreq = *req
 	*outreq = *req
@@ -309,8 +311,6 @@ func (p *ReverseProxy) ProxyHTTP(rw http.ResponseWriter, req *http.Request, rrr
 			domainWithoutPort = strings.Split(rrr.ProxyDomain, ":")[0]
 			domainWithoutPort = strings.Split(rrr.ProxyDomain, ":")[0]
 		}
 		}
 
 
-		hostname := req.Header.Get("Host")
-
 		//Replace the forwarded target with expected Host
 		//Replace the forwarded target with expected Host
 		locationRewrite = strings.ReplaceAll(locationRewrite, rrr.ProxyDomain, hostname)
 		locationRewrite = strings.ReplaceAll(locationRewrite, rrr.ProxyDomain, hostname)
 		locationRewrite = strings.ReplaceAll(locationRewrite, domainWithoutPort, hostname)
 		locationRewrite = strings.ReplaceAll(locationRewrite, domainWithoutPort, hostname)