May 22, 2015

Share your localhost with the world

tl;dr — It’s possible (and easy!) to share http://localhost:3000 with the world via a url like https://9880b06e.ngrok.io

I recently had a need to share a local Rails application I was working on with a client. Usually this involves deploying the application to some kind of staging environment. But sometimes this is just too much work. Luckily I discovered a tool called ngrok which makes this dead simple.

If you’re on a Mac (this works on Windows too) just head over to the download page: https://ngrok.com/download

After downloading ngrok unzip the download and move ngrok to an executable directory:

cp ~/Downloads/ngrok /usr/local/bin/.

Now let’s assume you’re running a Rails application on port 3000. To share with the world just run:

ngrok http 3000
puts "hello world"

And it’ll give you a url you can share with the world. Yes it really is that easy!