I have a few services which are behind Azure API Managment. When client send a request it looks like below:
Client -> Azure Api Managment -> Service A -> Service B
Sometimes Service B responses after 5min, but in the meantime Client gets 504 Gateway timeout. In Azure API Managment I set policy
<backend>
<forward-request timeout="300" />
</backend>
In documentation I saw below information, but if it is possible to set some settings for network infrastructure in the pipeline?
The amount of time in seconds to wait for the HTTP response headers to be returned by the backend service before a timeout error is raised. Minimum value is 0 seconds. Values greater than 240 seconds may not be honored as the underlying network infrastructure can drop idle connections after this time.
As the doco indicated, any value greater than 240 won't be reliable. So the best bet for you is to change the implementation a bit if that's in your control.
A simple one could be: instead of waiting for 5 mins, you change the request to "fire and forget", and once Service B has finished its execution, it can write the response somewhere the Service A can access. Your client can then keep pinging to see if the response is available.
This may not be feasible if you don't have control, but just suggested it as a workaround in case you do :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With