Sounds frustrating that something locally does work and on a deployed node not anymore!
For REST Consume actions, I would recommend to add custom error handling to it and look into the $latestHTTPResponse variable (log or debug it). Especially 4xx errors show what you did wrong as a consumer and then the reponse body can be very helpful.
A 502 Bad Gateway error is indicating that something is wrong with the connection and possibly the destination API isn't reached at all. This is mostly due to firewall rules (e.g. IP filtering), but as I understand correctly, the other 99 do work?
Did you verify the endpoint doesn't have typo's in it? For example pointing to http:// instead of https://
What kind of hosting do you use? I don't understand the part “We have been developing 2 apps using Mendix and those apps keep deploying in the Mendix cloud environment. ”. Are you deploying to Mendix licenced nodes?
Hopefully this helps you in the right direction.