Setting Up a Secure Cloudflare Tunnel to Access Your Local Site or App

Setting Up a Secure Cloudflare Tunnel to Access Your Local Site or App

Cloudflare Tunnel operates through a lightweight program called cloudflared, which connects your web server to Cloudflare's global network. Essentially, it lets you access services on your local computer remotely. It's like having your own private tunnel to the internet.

Think of it as an alternative to tools like Ngrok, but with free, long-lasting tunnels thanks to Cloudflare.

Here's why it's useful: While Cloudflare Pages gives unique URLs for testing new website versions, Cloudflare Tunnel lets you share applications and servers you're working on locally.

Ready to set it up? Follow this guide to install Cloudflare Tunnel and create a new tunnel for accessing your local applications. Just make sure you have a Cloudflare account to get started.  

Note: You must have a domain registered or pointed to cloudflare before you use this server.

create tonnel

Give the name to your tunnel.

download cloudflared cli for your system

Test your download is setup property by running following.

cloudflared --version

fill all the required field. if you have not configured https for your local host choose http, and put the port on where your local service is running, now you can call apis.mainblocs.com and it will hit your http://127.0.0.1:4000.

Back to blog