2

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

5
  • Is your domain proxied through Cloudflare? I've faced exactly the same issue before and in my case it was because we were using Cloudflare which has a limit of 100 seconds. It was an old application that had to be optimise to take less time to return a response. community.cloudflare.com/t/default-timeout-limit-increase/… Commented Jun 1, 2022 at 4:09
  • Thank you for your comment. We are not currently using cloudfare. Commented Jun 1, 2022 at 19:18
  • And what are the firewall (NSG/ASG) settings on your backend hosts?
    – Marco
    Commented Jun 10, 2022 at 7:49
  • 1
    Are you sure about the timeout happening at 100 sec is happening from the azure application gateway or from the backend server which is serving this particular request? Commented Jun 10, 2022 at 14:38
  • @VineeshVijayan I currently dont have any timeout configured on de app services. Commented Jun 11, 2022 at 23:00

2 Answers 2

3

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

4
  • do you have the source of the picture you posted? thanks! Commented Jun 22, 2022 at 14:29
  • I made it to explain the timeout issue Commented Jun 22, 2022 at 16:07
  • I get it. thanks! But I need information to check the default app service timeout is 100 sec. Since I've been searching and got no info about it. In fact in some places I found that the default app service timeout is 230 s Commented Jun 22, 2022 at 16:47
  • slowtick.com/pages/az-appgw-timeouts -> Default for app service servers, it is 2 minutes if IIS based, and the 100 sec I depicted coming from the application that hosted in-app services, Say if we are using HTTP client, then the default will be 100 sec. learn.microsoft.com/en-us/dotnet/api/… Commented Jun 23, 2022 at 4:43
0

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

1
  • 1
    Thanks for your reply. I can tell you we are not using Cloudfare. I will take a look to the other suggestions. Thank you Commented Jun 1, 2022 at 19:17

Not the answer you're looking for? Browse other questions tagged or ask your own question.