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.