Skip to content
Back to writing

~/writing field note

  • coolify
  • cloudflare
  • cloudflare-tunnel
  • self-hosting
  • networking

Expose Your Local Coolify Server with Cloudflare Tunnel

Mustafa Ramx pixel avatarBy Mustafa Ramx14 June 20256 min readUpdated 12 Nov 2025
Cover image for Expose Your Local Coolify Server with Cloudflare Tunnel
On this page7 sections
  1. Why Port Forwarding Doesn’t Always Work
  2. Meet Cloudflare Tunnel — Your New Best Friend
  3. Let’s Set It Up — Step by Step
  4. Install cloudflared on your Coolify host Ubuntu VM
  5. Test your setup: install Grafana on Coolify and access it via Cloudflare Tunnel
  6. Test it out
  7. What about security?

So you’ve installed Coolify (the open-source Heroku alternative) on your local Ubuntu VM (inside Parallels, VirtualBox, VMware, etc.), exposed ports 80 and 443, and everything works perfectly inside your network

But then… 💀 you try to visit your app from outside, like your 4G phone or a friend’s device — and boom — nothing loads!

Welcome to the Home ISP Port Blocking Club™.

Yes, some ISPs (especially here in Australia 🇦🇺) block ports 80 and 443 for inbound traffic. They hate hosting freedom 😅

Haven’t installed Coolify yet locally? Check out this full step-by-step guide first: How to Run Coolify on Local VM and Expose it Publicly.

I’m currently using this Cloudflare Tunnel setup to expose my Coolify-based staging environment to the internet for free. It’s super useful for sharing demos with clients, testing SSL and routing, and deploying services for review — all without opening ports or dealing with complex firewall rules. Highly recommended for any devs working on self-hosted apps or local CI/CD workflows.

Why Port Forwarding Doesn’t Always Work

Even if you set everything up right:

  • NAT rules
  • Coolify is running
  • You even did the uptime.111.222.33.44.sslip.io trick
  • Security issues

Still… it doesn’t work from mobile or the public internet?

That’s because your ISP blocks web ports, or you’re behind something nasty like Carrier-Grade NAT (CG-NAT).

Meet Cloudflare Tunnel — Your New Best Friend

Cloudflare Tunnel (aka cloudflared) is a free tool that lets you securely expose any local server to the internet — without opening a single port.

It works like magic:

  • Your domain
  • Free SSL
  • Free WAF
  • Free DDoS protection
  • No port forwarding
  • No public IP needed
  • Works even behind strict firewalls ;)

Let’s Set It Up — Step by Step

You’ll have your Coolify dashboard live on a public domain in under 10 minutes. Let’s go!

1. Requirements

  • Free Cloudflare account → dash.cloudflare.com
  • A domain (any domain you own — .com, .xyz, whatever)
  • Your domain must use Cloudflare DNS
  • A static local IP, which is normally similar to: 192.168.1.x

Example: coolify.mydomain.com

Install cloudflared on your Coolify host Ubuntu VM

Step-by-step via Cloudflare Zero Trust Dashboard (GUI method)

Prefer clicking around instead of CLI? 😎 No problem — Cloudflare gives you a full dashboard flow.

Here’s how to set up your Coolify tunnel using Cloudflare Zero Trust:

Go to dash.cloudflare.com, log in to your account, then from the homepage click “Zero Trust”. If it’s your first time, they might ask for a credit card (don’t worry — it’s still free, they just verify your account).

Create your tunnel

In the Zero Trust dashboard:

  • Go to Networks → Tunnels
  • Click “Create a Tunnel”
  • Choose “Cloudflared” as your connector type
  • Give it a name (e.g. coolify_tunnel)
  • Cloudflare will now show you exact commands to install cloudflared and run the connector

Create a Cloudflare Tunnel named coolify_tunnel

Install and run the connector

Cloudflare will ask you to choose your operating system and give you commands like these:

# Add the Cloudflare GPG key
sudo mkdir -p --mode=0755 /usr/share/keyrings
curl -fsSL https://pkg.cloudflare.com/cloudflare-main.gpg | sudo tee /usr/share/keyrings/cloudflare-main.gpg >/dev/null

# Add this repo to your apt repositories
echo 'deb [signed-by=/usr/share/keyrings/cloudflare-main.gpg] https://pkg.cloudflare.com/cloudflared any main' | sudo tee /etc/apt/sources.list.d/cloudflared.list

# Install cloudflared
sudo apt-get update && sudo apt-get install cloudflared

After you have installed cloudflared on your machine, install a service to automatically run your tunnel whenever the machine starts:

sudo cloudflared service install eyJhIjoiNGRlYz......

Boom — your server is now securely connected to Cloudflare 🎉

The cloudflared service has been installed on the host

Assign a domain

Back in the dashboard, after the tunnel is running:

  • Go to Public Hostnames
  • Add a hostname like coolify.mydomain.com
  • Point it to http://localhost

Add a public hostname pointing to http://localhost

And in your Coolify panel make sure the same domain is also set as the Instance Domain:

Coolify Instance Domain set to coolify.mydomain.com

Cloudflare will automatically create the DNS record and SSL cert for you — and that’s it. Your Coolify dashboard is now live, secure, and globally accessible, no port forwarding needed 👏

Important: configure SSL/TLS in Cloudflare for HTTPS access

To make sure your Coolify apps (like Uptime Kuma or Grafana) are accessible over HTTPS, you need to properly configure your SSL/TLS settings in Cloudflare.

Here’s how:

  1. Go to your Cloudflare dashboard
  2. Select your domain
  3. Navigate to SSL/TLS → Overview
  4. Check your encryption mode under “SSL/TLS encryption”

Recommended mode: Full — this ensures secure end-to-end encryption between Cloudflare and your server.

Cloudflare SSL/TLS encryption mode set to Full

Having issues? (Timeouts, redirect loops, site unreachable?)

If you face problems like:

  • Connection timeouts
  • Too many redirects
  • SSL errors
  • Site not loading at all

Try switching the mode to Flexible as a quick fix — it disables full backend verification but gets your site online instantly (great for testing).

And yes — all of this is completely free with Cloudflare 😉

Test your setup: install Grafana on Coolify and access it via Cloudflare Tunnel

Now that your Coolify server is up and running (and securely exposed to the internet with Cloudflare Tunnel 😎), let’s deploy something useful — and good-looking: Grafana.

Because what’s cooler than watching colourful charts of your server metrics while sipping coffee and pretending you’re in a sci-fi movie?

1. Open your Coolify dashboard

Head to your instance:

https://coolify.mydomain.com

2. Create a new project

Click “+ New Project”.

  • Name: grafana
  • Choose Grafana from the services

Create a new Grafana project in Coolify

Make sure the domain and the configuration look like this:

Grafana service domain and configuration in Coolify

3. Add a public hostname on cloudflared

Now we need to go to Cloudflare Tunnels to edit our tunnel and add a public hostname record for Grafana, like the following:

Add a public hostname for Grafana inside the Cloudflare tunnel

And taraa — we’re done :D we just deployed Grafana with Coolify and run it for free.

Test it out

  • Login: default is admin / admin
  • You’ll be prompted to change the password
  • Create your first dashboard, or connect to a data source like Prometheus or Loki

Need help with that too? Maybe a “Grafana + Prometheus + Loki” stack article next? 😉

What about security?

Don’t worry — Cloudflare Tunnel is end-to-end encrypted, and you get Cloudflare’s DDoS and WAF protection included.

Still, I recommend adding CrowdSec to your server (for bots & abuse protection) + Traefik AppSec WAF for serious app security.

Check my full guide here: Secure Your Coolify Server & Websites with CrowdSec and Traefik.

Found this useful or inspiring? You can support my work — buy me a coffee. Every little bit helps keep the magic alive — and my brain awake 😅

// share this note