Subgraph timeouts
Although the router comes with good defaults, you can change the timeouts according to your needs. For example, if you need to operate with very slow upstream services, you can increaserequest_timeout, which defines the maximum amount of time a request can take. Zero means no limit.
-
request_timeout: The maximum amount of time a request can take. The timeout includes connection time, any redirects, and reading the response body. -
dial_timeout: The maximum amount of time a dial will wait for a connect to complete -
keep_alive_idle_timeout: The maximum amount of time an idle (keep-alive) connection will remain idle before closing itself. -
keep_alive_probe_interval: Specifies the interval between keep-alive probes for an active network connection. -
tls_handshake_timeout: Specifies the maximum amount of time waiting to wait for a TLS handshake. -
response_header_timeout: If non-zero, specifies the amount of time to wait for a server’s response headers after fully writing the request (including its body, if any). -
expect_continue_timeout: If non-zero, specifies the amount of time to wait for a server’s first response headers after fully writing the request headers if the request has an “Expect: 100-continue” header.
Client timeouts
These timeouts apply to the connections between clients and the router. They protect the router against slow clients, for example clients that open a connection and then send the request headers or body very slowly (slowloris-style attacks), which would otherwise hold connection resources for a long time.-
request_read_timeout: The maximum amount of time to read the entire client request, including the headers and the body. It starts when the router begins reading the request. Defaults to60s, the minimum is1s. -
request_header_read_timeout: The maximum amount of time to read the client request headers. Use it to drop clients that send headers slowly without shortening the time allowed for large request bodies. Defaults to0s, which falls back torequest_read_timeout. This limit only applies to HTTP/1 connections. For HTTP/2 over TLS, slow headers are limited byidle_timeoutinstead, except while another stream on the same connection is still open (for example an SSE subscription). To cover that case, an upstream proxy or load balancer must enforce the limit. -
idle_timeout: The maximum amount of time an idle keep-alive client connection is kept open while waiting for the next request. Defaults to0s, which falls back torequest_read_timeout. -
write_timeout: The maximum amount of time to write the response to the client, measured from the end of reading the request headers. Defaults to0s, which disables a timeout.
request_read_timeout, the router responds with 408 Request Timeout and closes the connection.
The read timeouts don’t affect long-lived responses such as subscriptions over SSE or multipart. To limit how long the router waits for subgraphs, use the subgraph timeouts above.