How we used Clouflare Tunnels to slap Auth onto any application or service

Sam L'Huillier

May 05, 20235 min min read

In this guide, we show you how we used Clouflare tunnels to add an authentication barrier to any app or service running on a VM. This feature is how we build Brev Tunnel: a feature that let's any user apply auth to any of their apps. If you want to use it, skip to the end...

Some of this guide will use Golang code; you can easily port it to any language- particularly with the help of ChatGPT these days :).

What are tunnels?

Why are tunnels good?

Running a tunnel on a machine

Connecting an identify provider to Clouflarer

Here we need to use

Protecting a tunnel host with an Application

Granting new users access

Using Brev to manage tunnels