I'm trying đồ sộ host an azure trang web 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 bủ are 404 not found errors

dreftymac

32.3k26 gold badges124 silver badges187 bronze badges

asked Jun 7, năm nhâm thìn at 22:04

I had a setup with trang web servers behind a azure application gateway, some servers works properly and traffic đồ sộ 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 trang web 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 trang web on the target server. So the gateway assumes the server is dead and refused đồ sộ tự the redirect.

answered Dec 13, 2018 at 7:16

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 bủ but when I try đồ sộ pass that trigger back đồ sộ the actual function tiện ích, I can't see anything"

answered Aug 1, 2022 at 8:25

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

Here is the thing that got bủ (very) confused. It was working in most cases. However when passing a parameter value that would return a higher number of records, then the tiện ích would fail and return a 502 bad gateway. I randomly found that the fix was đồ sộ change the tiện ích đồ sộ 64 bits.

The thing that I don't understand is that the 502 error was returned instantly, it's lượt thích the code didn't even try đồ sộ load the records.

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

In my case something removed randomly the stack settings of my trang web app. Check your resource (web tiện ích or function tiện ích, 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.

answered Jun 8, 2023 at 21:18

I had the same problem with an api returning more kêu ca 200mb.

After trying many things, I've fixed changing the tiện ích service from 32 bits đồ sộ 64 bits.