Show off your Localhost with LocalTunnel

How to use the LocalTunnel gem to access your localhost on a different network

Today I had a need access my localhost from a device that was intentionally not on the same network, which meant I finally had a use case for playing about with LocalTunnel.

LocalTunnel is something I had heard of before but never really played with because I had no cause to, essentially it is a Ruby Gem that allows you to connect to your localhost on a specific port from a randomly assigned public address.

You install it the same way you would any gem;

gem install localtunnel

And you call it like this;

localtunnel -k ~/.ssh/ 3000

Which gives it your public ssh key and tells it to bind to port 3000.

Once this is done LocalTunnel will spit out a URL which you can copy and paste to access your local machine from anywhere.

Security Concerns?

My first and primary worry about this is that I am putting a part of my local machine on the internet, that obviously isn't deadly but because it is bound to one particular port, so long as you maintain good security practice on the thing you are now sharing with the world then your dev box is no less secure than your server should be, but I wouldn't advise running LocalTunnel for longer than you need to, it certainly shouldn't be considered a permanent solution to anything.

Recent posts View all

Ruby Rails

Removing fields with a Rails migration

Ruby on Rails gives you powerful tools to make removing old fields easy, lets walk through how we can do this


Calculating Instagram Velocity From Your Browser

A small script that lets you quickly work out the velocity for posts within a hashtag