Stuck behind a Proxy? Share your localhost to the WORLD using NGrok!!

by Sai Hemchandra

If you’re a web developer( you probably are if you’re reading this…), how many times have you wanted to share your local work to someone outside of your office, home, library, garage? Yes, we have version control – you can push up your code to Github…have your guinea pig pull/setup the code or view it on the staging server. After a few hours of the guinea pig running on its wheel, you are still waiting for his/her feedback. MAKE IT EASY by sending them a link where they (on their computer) could view your local environment (on your computer) in “real-time”.

mind_blown_tmt

How is this possible?

With Ngrok of course. Ngrok is a Go program, distributed as a single executable file for all major desktop platforms. There are no additional frameworks or other dependencies to install.

ngrok flow

Here’s how you can install it now and enjoy it’s benefits right away!

1. Install npm
2. Install node
3. Install sudo npm install -g ngrok
4. $ ngrok http 80

Courtesy of https://ngrok.com/docs/2#getting-started

If you see the above image, then the installation is done!

Now to get your own local host app on ngrok..
$ ngrok http
i.e. My app is hosted on localhost:8983, so i run ngrok http 8983.

ngrok provides users with a real-time web UI to inspect request details. Just open http://localhost:4040 and make a request to your URL. The request details will be displayed as well as response including the time, duration, headers, query parameters and request payload as well as the raw bytes on the wire (according to ngrok).

Feeling Unsecure? Let’s go and authenticate your ngrok.

Authenticating your ngrok service unlocks many advanced features that even includes more security. Sign up for an account here. Now configure ngrok with the the authtoken that appears on your dashboard.
Install your authtoken with the following simple command-
$ ngrok authtoken

Protect your tunnel with a password with the -auth switch.This enforces HTTP Basic Auth on all requests with the username and password you specify as an argument as seen below.

ngrok http -auth="username:password" 8080

A word of caution – don’t leave ngrok running all the time. It is not your new test server. Have fun with it and improve your web apps.

Fine More Information Here at the NGROK home page!

Leave a Reply

Your email address will not be published. Required fields are marked *

Tools & Practices

Tools and Technologies we use at Applied

Contact us now

Popular Posts