Random 502 bad gateway on azure application gateway

Hi,
I use an Azure gateway as a load balancer, which forwards requests to a VM running an Apache web server. The web server acts as a reverse proxy to forward a request endpoint. Randomly, I am seeing a 502 Bad Gateway. Can you please help me debug the issue?

Hi @akhil.mud,

Are you doing any labs? If yes, please share the link, and I’ll take a look.

Hi @raymond.baoly,
This is not from any labs. It is what I am facing at my workplace, and I am struggling to find a solution. Can you suggest some solutions that could be helpful?

Hi,

Please try to check the Application Gateway’s Backend Health to see if your VM is unhealthy. Review the Diagnostic Logs for backend errors. Ensure NSG rules allow traffic from the gateway on ports 80/443. Verify the health probes are correctly configured to monitor the VM’s status.