提高代理的传输时间和空间
This commit is contained in:
		
							parent
							
								
									83885990c0
								
							
						
					
					
						commit
						71c87b2993
					
				| @ -100,7 +100,7 @@ func main() { | |||||||
| 	indexHtmlPath := vueBuild + "/index.html" | 	indexHtmlPath := vueBuild + "/index.html" | ||||||
| 	mux.Handle("/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | 	mux.Handle("/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | ||||||
| 		if strings.HasPrefix(r.URL.Path, "/api/") { | 		if strings.HasPrefix(r.URL.Path, "/api/") { | ||||||
| 			r.ParseMultipartForm(100 << 20) | 			r.ParseMultipartForm(500 << 20) | ||||||
| 			// 对/api开头的请求进行反向代理 | 			// 对/api开头的请求进行反向代理 | ||||||
| 			proxy := httputil.NewSingleHostReverseProxy(apiURL) | 			proxy := httputil.NewSingleHostReverseProxy(apiURL) | ||||||
| 			proxy.ServeHTTP(w, r) | 			proxy.ServeHTTP(w, r) | ||||||
| @ -179,14 +179,14 @@ func NewBackend(mux *http.ServeMux, httpAddress string, muxPaths ...string) *Bac | |||||||
| 	client := &http.Client{ | 	client := &http.Client{ | ||||||
| 		Transport: &http.Transport{ | 		Transport: &http.Transport{ | ||||||
| 			DialContext: (&net.Dialer{ | 			DialContext: (&net.Dialer{ | ||||||
| 				Timeout:   300 * time.Second, | 				Timeout:   1500 * time.Second, | ||||||
| 				KeepAlive: 60 * time.Second, | 				KeepAlive: 120 * time.Second, | ||||||
| 			}).DialContext, | 			}).DialContext, | ||||||
| 			ForceAttemptHTTP2:     true, | 			ForceAttemptHTTP2:     true, | ||||||
| 			MaxIdleConns:          100, | 			MaxIdleConns:          200, | ||||||
| 			MaxIdleConnsPerHost:   100, | 			MaxIdleConnsPerHost:   200, | ||||||
| 			IdleConnTimeout:       300 * time.Second, | 			IdleConnTimeout:       600 * time.Second, | ||||||
| 			TLSHandshakeTimeout:   300 * time.Second, | 			TLSHandshakeTimeout:   600 * time.Second, | ||||||
| 			ExpectContinueTimeout: 1 * time.Second, | 			ExpectContinueTimeout: 1 * time.Second, | ||||||
| 		}, | 		}, | ||||||
| 	} | 	} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user