Van Darth Vadden
Van Darth Vadden

Reputation: 761

Azure application gateway not taking the timeout setting

I'm having an issue with the timeout of my application gateway waf v2. I set the timeout to 220 sec as showed in the following picture enter image description here

but im getting a 504 gateway timeout of a particular request at 100 seconds.

Do I need to have any other consideration for make this timeout possible?

[UPDATE] The error is a 504.0 Gateway timeout. If I force this error, putting a wait statement on my SP, the error is just a 504 Azure Gateway Timeout

Thanks in advance

Upvotes: 2

Views: 14035

Answers (2)

Vineesh Vijayan
Vineesh Vijayan

Reputation: 590

Most probably this is happening from your app service and not from the gateway. Since you are getting a timeout at 100 sec, this may be from the default http timeout. you can check the application gateway request timeout is set correctly by the below .

az network application-gateway show --resource-group <replace with your resource group> --name <replace with your application gateway name> --query 'backendHttpSettingsCollection[].{name: name, reque stTimeout: requestTimeout}'

if this is coming out as expected (230 sec), then you need to see your app service.

For example, if your backend is configured in azure app services, the typical deployment will be based on IIS and the default connection timeout is 2 minutes.

enter image description here

You can override the behavior of the app service. If it is in azure app service, you can use XDT to change the connection timeout attribute of weblimit .
If it is a.NET application that serves the request that you have mentioned and uses HTTP client, then the default timeout is 100sec. You should set a request timeout value that is greater than your application gateway

HttpClient httpClient = new HttpClient();
httpClient.Timeout = TimeSpan.FromMinutes(10);

https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpclient.timeout?view=net-6.0

Upvotes: 3

Sridevi
Sridevi

Reputation: 22242

The error 504 gateway timeout usually occurs when one or more servers could not complete the request within the allotted time and does not receive a timely response from gateway.

  • To verify if the backend is taking time for the response, you can enable diagnostic logs on application gateway.
  • By this you can find access logs for the time taken by backend for the response.
  • Using these logs, you can view Application Gateway access patterns and analyze important information.
  • Please check whether your domain is proxied via CloudFlare as @Ked Mardemootoo commented.

Please note that:

As your connections are getting dropped at less than the request time out seconds set, you need to find which connection is triggered.

To resolve the issue, please contact Azure Support.

For more information, please refer below links:

azure public ip - Causes for Application Gateway Connection Timeout - Stack Overflow

Random 504 Gateway timeout while doing load test with application gateway - Microsoft Q&A

Upvotes: 0

Related Questions