ngrok is an awesome open-source tool that will expose your local port as a public URL through SSL which you can copy from the CLI. It provides secure tunnels to your localhost server. This means that your localhost web server will receive the request through a public URL which is very handy if you need to share or demo or debug integration environments where it accepts only a public URL. Let’s walk through it!
This is very useful in integration where other pieces can only accept a public URL and you want to debug your REST API and see how it works. An example of this use case is Alexa Skill debugging.
The Alexa skill developer console needs a publicly accessible endpoint to process the request. Using ngrok, you can expose your localhost to a public URL and use it in the Alexa developer console and debug it.
The below example exposes an Azure function to make publicly accessible. This avoids deploying it to Azure for integration testing,
ngrok http 7071
Now I can configure this in the Alexa dev console and test it and share it with the world as needed.
This is very useful if you are looking for a temporary public URL for your localhost. You can share this public URL to demo it and you can also use it to test integration environments. And the best part is you can debug it. This is how you do it.
ngrok http -host-header="localhost:57142" 57142
If ngrok is not working, it could be one of the below reasons.
There is a lot of debate out there about security concerns. It is open source and would monitor in/outs of your traffic. I use it only for development testing with non-sensitive data. If it worries your more, use it in docker with non-sensitive data.
Legal Stuff