The HTTP spec says the following regarding the status code 502 - Bad Gateway. The 502 (Bad Gateway) status code indicates that the server, while acting as a gateway or proxy, received an invalid response from an inbound server it accessed while attempting to fulfill the request. But what exactly constitute an invalid response?
Of all the api that are failing, I modified one of the api just to return simple constructed object from repository, without it hitting the DB, for that api im getting success response, but when I hit that api also multiple times back to back, it also returns 502 Bad Gateway
node.js - Getting error while hitting my api using domain - Error 502 ...
About the 502 errors after configuring the application gateway, The main reasons are as follows. NSG, UDR or Custom DNS is blocking access to backend pool members.
In my case I got the same error (HTTP 502 Bad gateway curl 22) when I created a git repository on a server under user. Of course in this situation fcgiwrap and git-http-backend couldn't receive data from a client under user.
gitlab - GIT push, HTTP code = 502 error - Stack Overflow
Bad Gateway 502 is typically a sign that your destination server is not responding. I assume your other services are Docker container as well? If that is the case you could try to change localhost to their containername and use Docker-dns. But you need to put all containers in the same network for that to work. Another thing to try is to reverse your order of routes. If I remember correctly ...