Azure HTTP 504 gateway timeout w/long requests

Liliana Tang 1 Reputation point
2020-07-08T21:45:54.227+00:00

I received this message while trying to run the web app I deployed. Could you please look into this?

Thanks so much!

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,963 questions
0 comments No comments
{count} votes

4 answers

Sort by: Most helpful
  1. T. Kujala 8,706 Reputation points
    2020-07-09T02:50:45.747+00:00

  2. SnehaAgrawal-MSFT 18,366 Reputation points
    2020-07-13T07:23:34.757+00:00

    Thanks for reply! You may want to investigate this documentation Enable diagnostics logging for web apps in Azure App Service to analyze the logs to fetch more details on the issue.

    Possible reasons for this ; You might have a request that takes 2-3 minutes to complete. If you check your diagnostic logfile and see this info. "The specified CGI application encountered an error and the server terminated the process". Then you can fix this by going into your web.config in your sites/wwwroot folder and adding a requestTimeout="00:20:00 to the file.

    You may also want to know, the maxRequestLength indicates the maximum file upload size supported by ASP.NET, the maxAllowedContentLength specifies the maximum length of content in a request supported by IIS. Hence, you need to set both maxRequestLength and maxAllowedContentLength values appropriately to upload large files.

    You may refer the approach outlined in these blogs and see if that helps.

    Uploading Large Files to Azure Web Apps
    Troubleshooting – IIS RequestFiltering

    As mentioned in this article maxAllowedContentLength has type uint, checkout the Configuration attributes.

    Disclaimer: This response contains a reference to a third-party World Wide Web site. Microsoft is providing this information as a convenience to you.

    0 comments No comments

  3. Liliana Tang 1 Reputation point
    2020-07-14T03:18:18.487+00:00

    @SnehaAgrawal-MSFT Thank for the recommendation. You may be referring to Windows environment? We are having issues with the root of the site we have deployed. It is a Django running in Linux environment. When we access site/admin or site/api, they both work. However, if we just navigate to the main site https://app-wdts-prod-001.azurewebsites.net, it gave us a server error. Any other suggestions?


  4. SnehaAgrawal-MSFT 18,366 Reputation points
    2020-08-20T05:30:59.85+00:00

    The Resolution of above issue is updated below:

    1. The Versions of modules on requirement.txt were outdated.
    2. Remove the version of all the modules and added the module ‘whitenoise’ to requirements.txt.
    3. The following lines added to setting.py // settings.py MIDDLEWARE = [ 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
    4. After these changes the site started to work.
    0 comments No comments