502 Bad Gateway

aznsgsub@gmail.com 21 Reputation points
2020-11-16T19:49:10.007+00:00

Hi,

I'm working on azure "Application Gateway" configuration and setup by following link:

https://learn.microsoft.com/en-us/learn/modules/load-balance-web-traffic-with-application-gateway/1-introduction

I followed all the steps exactly from the doc but when do testing as specified from link:

https://learn.microsoft.com/en-us/learn/modules/load-balance-web-traffic-with-application-gateway/5-exercise-create-configure-application-gateway

I got "502 Bad Gateway", my questions are:

  1. Where can I get logs related to DNS setting?
  2. How to fix the issue?

Thanks !

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

Accepted answer
  1. suvasara-MSFT 10,016 Reputation points
    2020-11-17T02:06:21.697+00:00

    @aznsgsub@gmail.com , There might be many reasons for a gateway or proxy server issuing 502 bad gateway error on receiving an invalid response. I would recommend you go through these following checklist troubleshooting steps to find out the exact reason of this error,

    Step 1: Check whether the back-end pool is empty

    Step2: View the status of the back-end servers --> Check whether all the back-end servers are unhealthy.

    Step3: Check whether the problem is caused by a request time-out setting

    Procedure:

    1. If at least one server is healthy, try to increase the request time-out, and then check whether the problem is resolved. To do this, follow these steps:
    2. In Azure portal, select All resources, and then select the application gateway.
    3. On the Application gateway blade, select the HTTP settings.
    4. Select the HTTP setting you created. In the Request Timeout (seconds) box, enter a higher value, such as Or, enter a value that is greater than the number of seconds that your server takes to return the response to every request.
    5. Click Save.

    Step4: Check whether the problem is caused by incorrect rule order

    If you have both basic rules and path-based rules, make sure that the path-based rule is set to the higher priority. To change the priority of rules, follow these steps:

    1. In Azure portal, select All resources, and then select the Application gateway.
    2. On the Application gateway blade, select Rules.
    3. Check whether there is a basic type rule that is listed above the multi-site listener rules. If there is, delete the basic type rule, and then create a rule that has the basic listener. The new rule is put at the bottom of the list. In this manner, multi-site rules are prioritized.

    Step 5: If your issue persists, please contact Azure Support for further assistance. Let us know if you are looking for a one-time free support so that we can provide you with one.

    ----------

    Please do not forget to "Accept the answer" wherever the information provided helps you to help others in the community.

    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. aznsgsub@gmail.com 21 Reputation points
    2020-11-19T03:06:33.88+00:00

    Thanks...

    I have solved "502 Bad Gateway" issue by recreating the site.

    But still there are issues:

    1. For VehicleRegistration function, I followed the step number 3 from Step 4, e.g. I created multi-site listener rule after "Path-based" rule, multi-site listener rule is at the bottom, when I stopped webServer1 to test round-robin for vehicle Registration, I didn't get response from "http://vehicleapp6407.eastus.cloudapp.azure.com/VehicleRegistration/Create". until it became time out, looks like the request didn't hit webServer2 even though webServer2 was up and running (webServer1 was stopped), any advice why?
    2. LicenseRenewal function is not working, I got timeout response when test URL "http://vehicleapp6407.eastus.cloudapp.azure.com/LicenseRenewal/Create", please also provide advice....

    Thanks

    0 comments No comments