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

5

20

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

Denunciation answered 7/6, 2016 at 22:4 Comment(0)
A
22

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

Abednego answered 8/6, 2016 at 7:32 Comment(2)
I have same case but using Azure Portal. Resolution: Login to Azure Portal Go to your App Service Select your App Service Name Select TLS/SSL Settings Click Binding Under TLS/SSL Bindings, click the hostname Under Private Certificate Thumbprint, select non-expired cert and save and test your application.Misnomer
Hi @Misnomer i dont find that non-expired cert in my case.. could you please help me to do that ?Focus
H
3

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.
Honan answered 13/12, 2018 at 7:16 Comment(0)
X
2

We were getting a 502 response with an Azure function. The Function App was started, and all of our functions inside here were marked as "good". But when we checked the azure function process explorer, there were no java proceses (this was written in java... pity me)

When checking the Azure function logs, it turned out that someone had deployed a dynatrace integration and this was crashing the function on startup.

So 502 basically means "I can see you are triggering me but when I try to pass that trigger back to the actual function app, I can't see anything"

Xiphisternum answered 1/8, 2022 at 8:25 Comment(0)
J
0

In my case something removed randomly the stack settings of my web app. Check your resource (web app or function app, etc) configuration and confirm that everything is correct.

Azure will restart your application automatically after your changes and you can try a new release after that.

Jurisconsult answered 8/6, 2023 at 21:18 Comment(0)
U
0

I was also getting random 502 bad gateway errors from my Azure web apps (API). The endpoint is very basic stuff, get some input parameters (via header) and uses that to query a DB and returns a bunch of records.

Here is the thing that got me (very) confused. It was working in most cases. However when passing a parameter value that would return a higher number of records, then the app would fail and return a 502 bad gateway. I randomly found that the fix was to change the app to 64 bits.

The thing that I don't understand is that the 502 error was returned instantly, it's like the code didn't even try to load the records.

I still don't understand what was happening here, but happy I found the fix.

Unconstitutional answered 28/3 at 0:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.