0
votes

I have .net core API inside the web app and that web app is backend pool for azure application gateway. while trying to access the web app got below error.

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

On app GW, health prob for that web app in unhealthy but while access the API as a https://abc.azurewebsites.net/api/values then it works.

2

2 Answers

1
votes

When we deploy API in Web App Service then apiname.azurewebsites.net does not work give any probes to application gateway and treat unhealthy. API works like xxx.azurewebsites.net/api/values and Application Gateway also know this path. We have to put /api/values in override backend path of http settings. Same have to do in health probes.

0
votes

Yes, you can first verify if the backend API could access directly without app gateway. Then this error may happen due to the following main reasons:

  • NSG, UDR or Custom DNS is blocking access to backend pool members.
  • Back-end VMs or instances of virtual machine scale set are not responding to the default health probe.
  • Invalid or improper configuration of custom health probes.
  • Azure Application Gateway's back-end pool is not configured or empty.
  • None of the VMs or instances in virtual machine scale set are healthy.
  • Request time-out or connectivity issues with user requests.

Generally, the Backend healthy status and details could point it out and show some clues. You could also verify all of the above reasons one by one according to this DOC.