502 - Web server received an invalid response while acting as a gateway or proxy server.

390 Points
115 Posts

I have web-service hosted on Azure. And I'm tried to request an endpoint that has long running process. I'm getting following error after around 2 minutes:

<h2>502 - Web server received an invalid response while acting as a gateway or proxy server.</h2>
  <h3>There is a problem with the page you are looking for, and it cannot be displayed.
When the Web server (while acting as a gateway or proxy) contacted the upstream content server,
it received an invalid response from the content server.</h3>

Any one known what is happening here...

Views: 7663
Total Answered: 2
Total Marked As Answer: 0
Posted On: 29-Mar-2019 02:08

Share:   fb twitter linkedin
114 Points
27 Posts

"502 bad gateway" and "503 service unavailable" are common errors in your app hosted in Azure App Service.

This problem is often caused by application level issues, such as:

  1. requests taking a long time
  2. application using high memory/CPU
  3. application crashing due to an exception.

You need to trouble shoot on above mentioned points.  Troubleshooting can be divided into three distinct tasks, in sequential order:

Observe and monitor application behavior
Collect data
Mitigate the issue

Please follow on https://docs.microsoft.com/en-us/azure/app-service/troubleshoot-http-502-http-503 for more details how to trouble shoot.

Posted On: 30-Mar-2019 00:38
62 Points
26 Posts

502  or 503 errors won't be visible in IIS logs on Azure because they are returned by the front end server which basically forwards the requests to the worker hosting your site and there will be many reasons why the front end can return 502 or 503 error.

You can follow https://azure.microsoft.com/en-in/documentation/articles/app-service-web-troubleshoot-http-502-http-503/ to troubleshoot the issue and see if you can identify which one you are running into

Posted On: 04-Apr-2019 09:41
 Log In to Chat