Skip to content

Commit 0947966

Browse files
authored
Merging to release-5.8: [DX-1962] docs: document timeout requirements for proxy_default_timeout > 120s (#1128)
[DX-1962] docs: document timeout requirements for proxy_default_timeout > 120s (#1128)
1 parent 57a0e02 commit 0947966

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

api-management/troubleshooting-debugging.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,24 @@ sidebarTitle: "Troubleshooting"
394394
395395
You are able to see a more detailed output in your Gateway log `/var/log` or `/var/log/upstart`.
396396
397+
18. Gateway `proxy_default_timeout` vs `http_server_options.write_timeout`
398+
399+
**Tyk to Upstream timeout**
400+
401+
`proxy_default_timeout` specifies the amount of time that Tyk will wait for the upstream service to complete its reply to Tyk
402+
403+
With gateways prior to release 5.0.7 `proxy_default_timeout` defaulted to zero which would result in the gateway waiting forever. This consumed resources and could lead to depletion of ephemeral sockets.
404+
405+
Since gateway 5.0.7 `proxy_default_timeout` defaults to 30 seconds.
406+
407+
When increasing `proxy_default_timeout` beyond 120 seconds it is necessary to consider the client to Tyk timeouts.
408+
409+
**Client to Tyk timeouts**
410+
411+
`http_server_options.write_timeout` specifies the number of seconds that Tyk will keep the client connection open for Tyk to write to it. If this is less than `proxy_default_timeout` then the connection to the client will be closed and the upstream reply will not be proxied back to the client if the upstream takes longer than `http_server_options.write_timeout` seconds. To avoid this please make sure that `http_server_options.write_timeout`is at least 1 second longer than `proxy_default_timeout`
412+
413+
`http_server_options.read_timeout` specifies that number of seconds that Tyk will allow the client to complete sending the request to it. This usually doesn't need to be changed since a lot of data can be sent in the default of 120 seconds, but it can be changed if needed.
414+
397415
## Gateway Error Response Status Codes
398416
399417
Tyk Gateway responses include HTTP status codes that follow the [HTTP status code standard](https://datatracker.ietf.org/doc/html/rfc9110). They have three digits that describe the result of the request and the semantics of the response.

snippets/gateway-config.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ Type: `int`<br />
129129

130130
API Consumer -> Gateway network write timeout. Not setting this config, or setting this to 0, defaults to 120 seconds
131131

132+
<Note>
133+
134+
If you set `proxy_default_timeout` to a value greater than 120 seconds, you must also increase [http_server_options.write_timeout](#http-server-options-write-timeout) to a value greater than `proxy_default_timeout`. The `write_timeout` setting defaults to 120 seconds and controls how long Tyk waits to write the response back to the client. If not adjusted, the client connection will be closed before the upstream response is received.
135+
136+
</Note>
137+
132138
### http_server_options.use_ssl
133139
ENV: <b>TYK_GW_HTTPSERVEROPTIONS_USESSL</b><br />
134140
Type: `bool`<br />
@@ -979,6 +985,12 @@ Type: `float64`<br />
979985
This can specify a default timeout in seconds for upstream API requests.
980986
Default: 30 seconds
981987

988+
<Note>
989+
990+
If you set `proxy_default_timeout` to a value greater than 120 seconds, you must also increase [http_server_options.write_timeout](#http-server-options-write-timeout) to a value greater than `proxy_default_timeout`. The `write_timeout` setting defaults to 120 seconds and controls how long Tyk waits to write the response back to the client. If not adjusted, the client connection will be closed before the upstream response is received.
991+
992+
</Note>
993+
982994
### proxy_ssl_disable_renegotiation
983995
ENV: <b>TYK_GW_PROXYSSLDISABLERENEGOTIATION</b><br />
984996
Type: `bool`<br />

0 commit comments

Comments
 (0)