Skip to content

Commit

Permalink
gateway: increase the response timeout to 120 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
zllovesuki committed Jan 29, 2025
1 parent 819ed57 commit 17f37af
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion gateway/proxy_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ var delHeaders = []string{
"X-Forwarded-For",
}

const (
proxyHeaderTimeout = time.Second * 120 // global limit of how long the gateway will wait for response
)

// inspiration from https://blog.cloudflare.com/eliminating-cold-starts-with-cloudflare-workers/
// warm the route cache when tls handshake begins
func (g *Gateway) HandshakeEarlyHint(sni string) {
Expand Down Expand Up @@ -226,7 +230,7 @@ func (g *Gateway) proxyHandler(proxyLogger *log.Logger) http.Handler {
MaxIdleConnsPerHost: 5,
DisableCompression: true,
IdleConnTimeout: time.Second * 30,
ResponseHeaderTimeout: time.Second * 15,
ResponseHeaderTimeout: proxyHeaderTimeout,
ExpectContinueTimeout: time.Second * 5,
WriteBufferSize: g.Options.TransportBufferSize,
ReadBufferSize: g.Options.TransportBufferSize,
Expand Down

0 comments on commit 17f37af

Please sign in to comment.