Creating a tunnel to localhost with Cloudflare

I found this handy tip via @wesbos. You can create a temporary tunnel to localhost on your machine using Cloudflare.

Even better, if you use Cloudflare for a domain’s DNS, you can set up a permanent, named tunnel with a subdomain. Here’s how it works:

$ cloudflared tunnel login
$ cloudflared tunnel create local 
$ cloudflared tunnel route dns local
$ cloudflared tunnel run --url http://localhost:9999 local

I’ve previously used ngrok for free temporary URLs when developing against external APIs, but to create permanent tunnels was a paid feature. This is a nice, free alternative through a service I’m already using.