504 Gateway Timeout from Azure Application Gateway while testing Logic App

{tocify} $title={Table of Contents}



Issue



While testing an Interface, started getting following error intermittently

504 Gateway Timeout from Azure Application Gateway



and for one test case it was continuously   





Why it happened


The architecture consists of Application Gateway with APIM configured as Backend and Logic app configured as API in APIM.

Upon checking the logic app run history, found that the request were reaching logic app and were getting processed.

However for one of the test case requests where error was consistent, there was some issue and after retry it used to fail.

So fixed the issue and started testing again, consistent error scenario was gone but intermittently time out error was thrown.

Application Gateway gives a timeout error in the following scenarios:

  • The backend server is not responding. This could be because the server is down, overloaded, or unresponsive for some other reason.
  • There is a network issue between Application Gateway and the backend server. This could be caused by a firewall, router, or other network device blocking traffic, or by a problem with the network connection itself.
  • The backend server is taking too long to respond. This could be because the server is processing a complex request, or because it is overloaded with requests.
  • The Application Gateway timeout setting is too low. By default, Application Gateway will wait 20 seconds for a response from the backend server before returning a timeout error. This value can be increased, but it is important to set it to a value that is appropriate for the backend server and the types of requests that it is processing.

What to do


As now all the request were reaching the logic app and also processing was successful , checked the response time and that was the reason.

The processing time of some logic apps was going above 20 seconds and thus the response time was above 20 seconds.

So Timeout has to be adjusted.

To set a timeout on the backend of an Application Gateway, you need to configure the request timeout setting in the backend settings. This setting controls the amount of time that Application Gateway waits for a response from the backend server before returning a timeout error.

To configure the request timeout setting, follow these steps:

  • Go to the Azure portal and navigate to your Application Gateway.
  • Click on Settings.
  • Under Backend settings, click on the Backend setting that you want to configure the timeout for.
  • In the Request timeout section, enter the number of seconds that you want Application Gateway to wait for a response from the backend server before returning a timeout error.
  • Click on Save.

The default timeout value is 20 seconds. You can increase or decrease this value depending on your needs.




Post a Comment

If you have any suggestions or questions or want to share something then please drop a comment

Previous Post Next Post