Thursday, February 18, 2021

Troubleshooting Bad Gateway errors for Ngrok

Ngrok is one of the well-known tool for local tunneling solution. I have used it many times being the easiest tool for any developer.

This time once again, I thought to use Ngrok for my current application, which uses Graph API to get notifications from Microsoft Teams channel. As always, I launched the Ngrok with required port as shown below:

  1. ngrok http 44332  

and it got connected as shown below:







Till now everything is alright. But now when I ran my application with Ngrok’s forwarding address, I end up getting an error - 400 Bad Request.








And here is what I read more about this:

Seems like some applications can’t deal with the default behavior of Ngrok and need an explicit mention of header information, which means there is another way to handle such scenario:

  1. ngrok http http://localhost:44332 -host-header="localhost:44332"

After connecting Ngrok with above command, everything went very smooth and as expected.







Hope this tip would be useful for you too.

No comments:

Post a Comment