mirror of
https://github.com/gravitational/teleport
synced 2024-10-21 01:34:01 +00:00
Add timeout to auth http requests (#13976)
Sets the `Timeout` of the http.Client used by the auth client to 30s to prevent requests from blocking indefinitely. There have been several failure scenarios that result in teleport being completely stuck due to never receiving a response from an http request. The 30s upper bound should prevent this, while also being long enough that it shouldn't impact any requests which may be slow.
This commit is contained in:
parent
3c2decdca7
commit
0e937edd4d
|
@ -193,7 +193,10 @@ func NewHTTPClient(cfg client.Config, tls *tls.Config, params ...roundtrip.Clien
|
|||
|
||||
clientParams := append(
|
||||
[]roundtrip.ClientParam{
|
||||
roundtrip.HTTPClient(&http.Client{Transport: otelhttp.NewTransport(breaker.NewRoundTripper(cb, transport))}),
|
||||
roundtrip.HTTPClient(&http.Client{
|
||||
Timeout: defaults.HTTPRequestTimeout,
|
||||
Transport: otelhttp.NewTransport(breaker.NewRoundTripper(cb, transport)),
|
||||
}),
|
||||
roundtrip.SanitizerEnabled(true),
|
||||
},
|
||||
params...,
|
||||
|
|
|
@ -112,6 +112,9 @@ const (
|
|||
// HTTPIdleTimeout is a default timeout for idle HTTP connections
|
||||
HTTPIdleTimeout = 30 * time.Second
|
||||
|
||||
// HTTPRequestTimeout is a default timeout for HTTP requests
|
||||
HTTPRequestTimeout = 30 * time.Second
|
||||
|
||||
// WebHeadersTimeout is a timeout that is set for web requests
|
||||
// before browsers raise "Timeout waiting web headers" error in
|
||||
// the browser
|
||||
|
|
Loading…
Reference in a new issue