Hi,
Let me know if my understanding is right:
If you try to access the Application Server via Application gateway and it is returning 200OK --> This means that the health probes are configured right.
When you try to access a path where Application server need to communicate with SQL you are getting 502. --> This could be due to the timeout where Application server took more than 20 secs to respond to the request initiated from the client.
If that is not the case, please provide a fiddler tracer when you are getting the 502 to assist further.
Regards,
Karthik Srinivas