Azure Application Gateway : Debugging the dreadful “502”-error


When you set up your Application Gateway on Azure, and you’re getting the following message…


Then you know you are in a world of pain in order to debug this. So before we continue, please help to avoid this pain by voting on the user voice! 😉


The Basics

When we take a look at the documentation, then we see how the logic works… Basically it will do a GET of the following url on each node ; The (healthy) response should be a status code between 200 and 399.

Apart from that, once you have created the application gateway. Your back-end pool will be empty. So the first thing to check is if you’ve already added your nodes.


Example Troubleshooting : Rancher node shown as down

After cursing for a while, I did a network trace to see what was happening. As my host was an Ubuntu (Linux), I used tcpdump ;

tcpdump port 80


As you can see from the output, there is a “401 Unauthorized” error code. We just learned that the response should be between 200 and 399, so we’re 2 short of a good status.


So how to fix this? Let’s create a custom node…


Why change to this?


Because loading the /login/ page will get you a 200 or 304 (depending on the previous sequence). These values reside between 200 and 399, so we’re good!

One thought on “Azure Application Gateway : Debugging the dreadful “502”-error

  1. Thanks a bunch. I was accessing web service page which actually returns the default “See help page” but with code 404. So I just used the help page as probe by following your instructions and it worked!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.