What causes a 502 Bad Gateway error? Server overload: An overloaded server is one of the most common causes of a 502 error. This is where the server has reached its memory capacity, often activated by an unusually high number of visitors trying to access the same website.
If ngrok is not working, it could be one of below reasons. If you are behind the proxy check your proxy and firewall settings. Always expose HTTP port and ngrok will give you HTTPS and redirect properly. The free account will give you one URL only.
This worked for me
ngrok.exe http -host-header=rewrite localhost:<Your Port number>
e.g:
ngrok.exe http -host-header=rewrite localhost:5219
Im using visual studio 2017 dont know if it effects anthing.
Try to explicitly set the localhost IP:
ngrok http 127.0.0.1:5000
instead of ngrok http 5000
Good luck!
Just as @njzk2 should have said, if you don't have a web server running so it cannot work. I would like to make it clearer to you, if you are still confused.
What ngrok does, is to make your local server (running on localhost) to be available to the outside world (rest of the internet). On its own, it is not a web server. So for your bot development you need to have a web server running on a defined port (which in your case is 5000). Then you can point ngrok to this port so that it will redirect requests sent to your public address to the program running on that port. The web server will then accept and handle requests from Facebook
I found I had to remove the quotes around the -host-header section to get this to work with the latest ngrok version (2.3.35):
ngrok http https://localhost:5001 -host-header=localhost:5001
(Currently not enough rep to add comments on any of the answers above)
Step 1 - Register to ngrok and download .exe file in dashboard page
Step 2 - Open terminal and copy & paste from the dashboard the line without ./
Step 3 - run your localhost
Step 4 - If step 2 was successfully done, paste in the same terminal (step 2) the line with your localhost port
ngrok http https://localhost:44386 -host-header="localhost:44386"
Step 5 - Copy the URL generated in the terminal and waalla.. you can ping to it.
In case of <<<<Ngrok errors '502 bad gateway'>>>> change https into http so the Step 4 will be ngrok http http://localhost:44386 -host-header="localhost:44386"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With