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