Better Programming

Advice for programmers.

Follow publication

Member-only story

Ngrok: Make Your Localhost Accessible to Anyone

Jay Patel
Better Programming
Published in
3 min readMay 12, 2020
Photo from ngrok.

Local development makes the process fast and easy to test as you change your code continuously. But in doing so, you might run into situations where you need to make it available publicly via accessible URL while you’re still in the development phase. Maybe you want to show your work to a client or colleague, or you need a secure, publicly available callback URL to interact with a web service. You could go ahead and upload your app to a hosting platform like Heroku or AWS, but then every time you make an update, you’d have to push those changes to your host server. Not great, right?

Luckily, ngrok is an amazing utility that creates an instantly secure, publicly accessible tunnel URL to an application that’s running on the localhost. In short, you can expose your local web server, APIs, databases, etc. So, It’s easier to expose your services when you don’t have big changes and don’t want to deploy it on your development environment.

How to Get Started

Ngrok is very easy to install and doesn’t have runtime dependencies. Just unzip it, add it to your path, and run it on your terminal.

Step 1: Download ngrok

Download ngrok for your OS.

Step 2: Unzip it

Unzip it, and if you want, add it to your path (move it to /usr/local/bin or use your favorite command):

$ unzip /path/to/ngrok.zip

Step 3: Connect to your account

Running this command will add your auth token, list your open tunnels in the dashboard, give you longer tunnel timeouts, and more. You can generate your token from the dashboard, and guess what? It’s totally free!

$ ./ngrok authtoken <YOUR_AUTH_TOKEN>

Step 4: Run it!

Remember, you need to add ngrok to your path or use ./path/to/ngrok.

$ ngrok help

Expose your HTTP’s service (i.e. my server running on port number 8080, but you can change it accordingly):

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Jay Patel
Jay Patel

Written by Jay Patel

Full-Stack Software Engineer | Google Cloud Certified Associate Cloud Engineer | https://jaypatel.co.in

Responses (1)

Write a response