Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I'm trying to host an azure website and tried troubleshooting for a few hours, but still keep getting the same error 502 Web server received an invalid response while acting as a gateway or proxy server.

I tried enabling logging errors on azure, but all it gives me are 404 not found errorssee error log

like image 663
Riz Avatar asked Jun 07 '16 22:06

Riz


2 Answers

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

Please 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

like image 180
Puneet Gupta Avatar answered Sep 19 '22 05:09

Puneet Gupta


I had a setup with web servers behind a azure application gateway, some servers works properly and traffic to one of the server is having the 502 issue. So I take the following steps:

  1. Check the Backend health on the application gateway, the server can't be reached.
  2. Open the backend server url on a cloud VM http://hostname, the root website can't be reached. But the http://hostname/app is running. It turns out the gateway will ping the port 80 of the target machine and somehow I disabled the root website on the target server. So the gateway assumes the server is dead and refused to do the redirect.
like image 43
Hainan Zhao Avatar answered Sep 21 '22 05:09

Hainan Zhao