Trying out ngrok


Kurian Benoy


May 23, 2021

ngrok is a cross-platform application software for enabling developers to deploy or expose their web applications from locally with a associated website url. This works due to the SSH tunnelling.

So this weekend I was trying out ngrok with few of the projects I have worked:

Hosting Cartoonizer is a long pending issue for me. The cartoonizer to use with ngrok. I downloaded the package: flask-ngrok. Just making a few changes as mentioned in the below article got the application up and running with a https url. The application was up and running, yet when I tried uploading an image to cartoonize, it failed to work due to the usage of os module in my library to fetch and cartoonize image.

Since this is a Vue application, I was expecting to easily use along ngrok. Instead of using any packages this time, I created an account in ngrok and downloaded the client for the operating system. Then on authenicating with my token and running the command:

ngrok http 3000

I was expecting my application to be up. Yet, I faced an error message:

Invalid Host Header

On googling a bit, I stumbled upon a solution once I ran the command:

ngrok http 3000 -host-header="localhost:3000

So my application was up and running after a 20-30 seconds page delay(which I am curious why though?)

Since this was a streamlit application. When I tried installing in windows, it gave me some SocketIO connection error, which didn’t run my application. So then I used wsl to run the project and on running it up, it was not getting pointed to an internal IP address instead of localhost. So when I ran ngrok, like the previous approach. It was not working in associated port. I need to see how can I point an internal IP to ngrok or get this application running in localhost.

So I am winding off by sharing how ngrok works. Also some good news 🌼, after nearly 5 months - I have contributed to Shahul’s latest open source project- Twitter Emotion. The project given an input tweet, extracts the phrase in the tweet associated to express a particular sentiment.