Tunnels & Testing

Several weeks ago I started writing apps with Flask and I really dig it, but I’ve had to change how I test and share projects. Unlike basic JavaScript / PHP driven apps, you can’t just FTP source to your web host and email your friends a URL. Dependencies, databases, and other details get in the way. The same goes for Rails and Django.

So how can you share your local dev environment with a friend for some fast feedback? You could deploy it to a PaaS like OpenShift or Heroku - but for quick and iterative testing that’s overkill.

Instead, get ngrok from Alan Shreve. Written in Go, ngrok creates a publicly accesible tunnel to your local web server. Get up and running by specifying a target port ./ngrok 5000 and sharing the forwarding URL. Tunnels support http & https and have a local web interface for monitoring traffic.

ngrok example
the ngrok console

Ngrok works great out of the box, but if you sign up (free!), you’ll get access to custom subdomains, simultaneous tunnels, and password protection. Binaries are available for Windows, OSX, and Unix - so everyone is invited to the party!

Join the discussion

2017 Neal Shyam