diff --git a/providers/dns/otc/otc.go b/providers/dns/otc/otc.go index 3bb11cecc..3569e6343 100644 --- a/providers/dns/otc/otc.go +++ b/providers/dns/otc/otc.go @@ -5,7 +5,6 @@ import ( "context" "errors" "fmt" - "net" "net/http" "time" @@ -55,6 +54,16 @@ type Config struct { // NewDefaultConfig returns a default configuration for the DNSProvider. func NewDefaultConfig() *Config { + tr := &http.Transport{} + + defaultTransport, ok := http.DefaultTransport.(*http.Transport) + if ok { + tr = defaultTransport.Clone() + } + + // Workaround for keep alive bug in otc api + tr.DisableKeepAlives = true + return &Config{ TTL: env.GetOrDefaultInt(EnvTTL, minTTL), PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, dns01.DefaultPropagationTimeout), @@ -62,21 +71,8 @@ func NewDefaultConfig() *Config { IdentityEndpoint: env.GetOrDefaultString(EnvIdentityEndpoint, defaultIdentityEndpoint), SequenceInterval: env.GetOrDefaultSecond(EnvSequenceInterval, dns01.DefaultPropagationTimeout), HTTPClient: &http.Client{ - Timeout: env.GetOrDefaultSecond(EnvHTTPTimeout, 10*time.Second), - Transport: &http.Transport{ - Proxy: http.ProxyFromEnvironment, - DialContext: (&net.Dialer{ - Timeout: 30 * time.Second, - KeepAlive: 30 * time.Second, - }).DialContext, - MaxIdleConns: 100, - IdleConnTimeout: 90 * time.Second, - TLSHandshakeTimeout: 10 * time.Second, - ExpectContinueTimeout: 1 * time.Second, - - // Workaround for keep alive bug in otc api - DisableKeepAlives: true, - }, + Timeout: env.GetOrDefaultSecond(EnvHTTPTimeout, 10*time.Second), + Transport: tr, }, } }