GolangWebDev
GolangWebDev
796 0 0

Increase the waiting time for ReverseProxy

Use the DefaultTransport (default timeout is 30 seconds)

Try adding something like this for setting timeout:

reverseproxy.Transport=&http.Transport{
    Proxy: http.ProxyFromEnvironment,
    DialContext: (&net.Dialer{
        Timeout:   60 * time.Second,
        KeepAlive: 60 * time.Second,
        DualStack: true,
    }).DialContext,
    MaxIdleConns:          100,
    IdleConnTimeout:       90 * time.Second,
    TLSHandshakeTimeout:   10 * time.Second,
    ExpectContinueTimeout: 1 * time.Second,
}
proxy.Transport = &http.Transport{
    ResponseHeaderTimeout: 5 * time.Second,
}

That's enough.

0

Discussion

Login Topics