Tyk Timeouts proxy_default_timeout

Hi,
I’m getting timeout errors with status code 504 from tyk.

The error message: http: proxy error: net/http: timeout awaiting response headers

My understanding is that the timeout is cause by the configuration proxy_default_timeout which is default to 30s and if the upstream request take more the above error will happen.

I also have ‘response’ custom middleware which is not called in this case, is this the design?

I have a use case which I want to handle this timeout scenario, what are my options as it seems like the ‘response’ custom middleware which I have is not called in this use case?

Thanks

Hey @Uri_Parush

Thank you for reaching out.

Gateway v5.2.5 and above, contains a patch which makes proxy_default_timeout default to 30 seconds.

In this case, the proxy_default_timeout always takes precedence if it has the lower value between itself and an endpoint config.

For the enforced timeout per endpoint to work, its value should be lower than proxy_default_timeout.

As an example, If the target endpoint takes 40 seconds, then you can configure the enforced timeout to something like 50 seconds and the proxy_default_timeout to 60 seconds.

We have an internal ticket to address the issue where the proxy_default_timeout overrides the enforced timeout middleware while it should only be applied when the enforced timeout is unset.

Thank you for the response.

In case of a timeout I want to had a custom logic in a middleware.
How this can be done?

Thanks