Tuning HTTP Timeout Settings in Your Web Application
While building web applications, we come across various scenarios where we have to change the default HTTP timeout duration as per our need.
Below are the ways to change the timeout in various libraries or components.
- Ocelot (.NET)
The default timeout for Ocelot is 90 seconds. (Same as HttpClient library.)
{
"DownstreamPathTemplate": "/api/v1/{everything}",
"DownstreamScheme": "http",
"DownstreamHostAndPorts": [
{
"Host": "localhost",
"Port": 8012
}
],
"UpstreamPathTemplate": "/LoanManagement/{everything}",
"UpstreamHttpMethod": ["GET", "POST", "PUT", "DELETE", "PATCH"],
"QoSOptions": {
"TimeoutValue": 300000
}
},
- Axios (Javascript)
For axios, the default timeout is unlimited by default. We can change this by passing {timeout: 15000} in config parameter.