Browse Source

auto update script executed

Toby Chui 1 year ago
parent
commit
18aa22a556
1 changed files with 6 additions and 1 deletions
  1. 6 1
      mod/dynamicproxy/dpcore/dpcore.go

+ 6 - 1
mod/dynamicproxy/dpcore/dpcore.go

@@ -89,10 +89,15 @@ func NewDynamicProxyCore(target *url.URL, prepender string) *ReverseProxy {
 
 	}
 
+	//Hack the default transporter to handle more connections
+	http.DefaultTransport.(*http.Transport).MaxIdleConns = 1000
+	http.DefaultTransport.(*http.Transport).MaxIdleConnsPerHost = 1000
+
 	return &ReverseProxy{
 		Director:  director,
 		Prepender: prepender,
 		Verbal:    false,
+		Transport: http.DefaultTransport,
 	}
 }
 
@@ -355,7 +360,7 @@ func (p *ReverseProxy) ProxyHTTP(rw http.ResponseWriter, req *http.Request, rrr
 			//locationRewrite = strings.ReplaceAll(locationRewrite, domainWithoutPort, rrr.OriginalHost)
 		} else if strings.HasPrefix(originLocation, "/") && rrr.PathPrefix != "" {
 			//Back to the root of this proxy object
-			//fmt.Println(rrr.ProxyDomain, domainWithoutPort, rrr.OriginalHost)
+			//fmt.Println(rrr.ProxyDomain, rrr.OriginalHost)
 			locationRewrite = strings.TrimSuffix(rrr.PathPrefix, "/") + originLocation
 		} else {
 			//Relative path. Do not modifiy location header