azure application server is working but while it fetches the data from azure SQL VM it throws 502 bad gateway error

Robin Hitch 165 Reputation points
2023-08-18T06:14:35.34+00:00

When traffic hits the application server I got a status 200 OK , but when Application server tries to fetch the data from the Azure SQL VM , Application Gateway returns 502 BAD GATEWAY. Both resources in same V-net and backend status are healthy. is there any specific port or UDR need to be configured ?

Azure Application Gateway
Azure Application Gateway
An Azure service that provides a platform-managed, scalable, and highly available application delivery controller as a service.
1,173 questions
{count} votes

2 answers

Sort by: Most helpful
  1. msrini-MSFT 9,291 Reputation points Microsoft Employee
    2023-08-19T07:05:51.69+00:00

    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

    0 comments No comments

  2. Robin Hitch 165 Reputation points
    2023-08-20T15:41:16.6233333+00:00

    Hi @msrini-MSFT ,

    Thanks for your response over my question.

    As per your suggestion we collected logs from the Application server and DB server, but we could see all get and post operations working fine.

    So at some we decided to move the App server NIC to DB server subnet, After the changes without flaws we could retrieve data from DB server.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.