Cloudflare Tunnel lets a machine that can't accept incoming connections (a home server behind your router, a laptop, a VPS with every port closed) serve websites on your domain. A small program, cloudflared , opens an outbound connection to Cloudflare, and Cloudflare sends your visitors' requests down it. You get HTTPS, DDoS protection and no open ports, for free.
What you need
A domain using Cloudflare's nameservers (add it to Cloudflare and change the nameservers at your registrar)
A Linux machine running your app on local ports, for example a website on localhost:8080 and an API on localhost:8000
1. Create the tunnel
In the Cloudflare dashboard, go to Networking β Tunnels (in the Zero Trust dashboard it's Networks β Tunnels ) and click Create a tunnel . Choose cloudflared , give it a name such as home-server , and save.
Cloudflare shows install commands for your operating system.β¦