Reputation: 6686
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 errors
Upvotes: 22
Views: 123144
Reputation: 56
I had the same problem with an api returning more than 200mb.
After trying many things, I've fixed changing the app service from 32 bits to 64 bits.
Upvotes: 1
Reputation: 1106
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.
Upvotes: 1
Reputation: 36
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.
Upvotes: 0
Reputation: 19235
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"
Upvotes: 2
Reputation: 2092
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:
Upvotes: 3
Reputation: 2307
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
Upvotes: 22