Azure-docs: forward request - how to increase the default timeout

Created on 17 Apr 2020  Â·  5Comments  Â·  Source: MicrosoftDocs/azure-docs

According to documentation this code sample must increase the timeout of forward request

<backend>
     <forward-request timeout="120" fail-on-error-status-code="true" />
     <!-- effective policy. note the absence of <base/> -->
</backend>

Also I investigate this issue and saw that it's possible to set the timeout up to 4 minutes

I'm trying to set the timeout for 120 seconds for example. To test the configuration I created the test API and hosted it as Azure App Service. In my test endpoint I'm waiting for 100 seconds for example to imitate the real payload.  But the API Management client close the connection before my test API returned the response.
 
In my App Insights logs of API Management  I see the following error "ClientConnectionFailure at forward-request" "The operation was canceled."
I also check logs of my test API and I see the the response is returned after 100 seconds. But looks like the API Management client can not handle this response due the connection failure, it's not waiting for the response from backend and just close the connection after timeout.
 
If I decrease the waiting time in my test API to 55-57 second my API Management works well and I get the response.
 
Finally I see that my settings of timeout is not working in API Management . And I can not override the default timeout which is probably equals to 60 seconds
 
What I'm doing wrong?


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri3 api-managemensvc cxp product-question triaged

All 5 comments

@alexanderbikk Thank you for your feedback! We will review and update as appropriate.

@This is indeed the way to set the timeout, at least on the APIM level. Also, as mentioned in this doc, values above 240 seconds may not work due to the network infrastructure dropping connections.

As for your case, could you share how you are making the request to APIM to test this scenario. I believe it is possible that the client you are using is timing out.

@PramodValavala-MSFT
Indeed. After your response I have tested in Postman and it works.

All the time I did my tests through Azure portal and Azure Dev portal. I don't know why I even not tried to test my API in Postman.
But for me, this is unexpected behavior of the Azure portal. Looks like I can't test the API through portal if my timeout more that 1 minutes. Maybe I missed something in docs and this is known issue\behavior.

Thanks for your answer

@alexanderbikk Glad that worked and thanks for confirming it! I will confirm with the concerning team about the timeout behavior when testing it from the Azure Portal and keep this thread posted.

Since there is no doc update required for the policy, we will now proceed to close this thread. If there are further questions regarding this matter, please tag me in your reply. We will gladly continue the discussion and we will reopen the issue.

Hi @PramodValavala-MSFT @mike-urnun-msft - Just spent almost a day figuring this out before finding this GH issue, please do make it clear in the testing tab itself about the timeout if in case that's any sort of restriction

Was this page helpful?
0 / 5 - 0 ratings