---
title: "Accesing a URL on localhost from the internet with ngrok"
date: 2020-05-17T00:00:00+00:00
author: "poornerd"
canonical: https://www.poornerd.com/2020/05/17/accessing-localhost-from-the-internet-for-development.html
source: Raw Markdown twin of the HTML article; content is the original source.
---
Have you ever needed to expose a URL from you local development machine to the internet in order to test something, or let someone else take a quick look?

I hate messing with my router, and trying to open up a URL through my firewall or NAT - especially if it is a one time thing for testing.

A friend put me on to __ngrok__ - ([https://www.ngrok.com](https://www.ngrok.com)) - which sets up one time URL's while running. There is a free version, but also a professional verison if you want to have more features, like your own domains or regularly using the same URL.

![ngrok](/images/posts/ngrok_example.png){:class="img-fluid w-100"}

A simple one is setup like this:
```
$ ngrok http 8080
```

You can also add a password protection with basic auth like this:
```
$ ngrok http -auth "user:password" 80
```

Once it is started, you see information in your terminal, along with a monitoring of requests coming in:
```
Session Status                connecting                                                                                                 Session Status                online                                                                                                 Account                       Brian Porter (Plan: Free)                                                                                      Versionerface                 2.3.35                                                                                                R gio                         United States (us)                                                                                    Web Interface                 http://127.0.0.1:4040
Forwarding                    http://5b551cd9.ngrok.io -> http://localhost:9000                                                         Forwarding                    https://5b551cd9.ngrok.io -> http://localhost:9000
```

