Cloudflare Tunnel
Great β if you already have a domain name on Cloudflare, the best option is to use Cloudflare Tunnel (formerly Argo Tunnel). It lets you:
- Expose your local server to the internet without a static IP
- Use your own custom domain
- Avoid port forwarding
- Get free HTTPS certificates automatically
Step 1: Install cloudflared
β
On your server:
wget -q https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
sudo dpkg -i cloudflared-linux-amd64.deb
Step 2: Authenticate Cloudflareβ
cloudflared tunnel login
This will open a browser to log in and pick your Cloudflare domain.
Step 3: Create the Tunnelβ
cloudflared tunnel create openwebUI
This creates a named tunnel and gives you a tunnel ID and credentials file.
Step 4: Create a Config Fileβ
Default location: ~/.cloudflared/config.yml
tunnel: openwebUI
credentials-file: ~/.cloudflared/51049f68-692e-4e7c-a22c-5c7e4f202391.json
ingress:
- hostname: openwebui.coinsgpt.io
service: http://localhost:3000
- service: http_status:404
Replace:
yoursub.yourdomain.com
β a subdomain you want to exposelocalhost:3000
β your actual local server address
οΈ Step 5: Set up DNS Routeβ
cloudflared tunnel route dns openwebUI openwebui.coinsgpt.io
This automatically adds a CNAME record in your Cloudflare DNS pointing to the tunnel.
Step 6: Run the Tunnelβ
cloudflared tunnel run openwebUI
Now your app is live at:
https://openwebui.coinsgpt.io
Summaryβ
Feature | Cloudflare Tunnel |
---|---|
Static IP needed? | β No |
Uses your domain? | β Yes |
HTTPS? | β Automatic |
Port Forwarding? | β Not required |
Free? | β Yes (generous limits) |
Bug Fixingβ
If cloudflared
cannot resolve Cloudflare's edge SRV records due to a DNS issue on your server. The resolver 127.0.0.53
(systemd-resolved) is failing to look up _v2-origintunneld._tcp.argotunnel.com
.
1. Test DNS resolution
Run:
dig srv _v2-origintunneld._tcp.argotunnel.com @1.1.1.1
If this works, your local DNS (127.0.0.53
) is broken or blocked.
2. Use Cloudflare's DNS (1.1.1.1 & 1.0.0.1)
Edit /etc/resolv.conf
, add following DNS server:
nameserver 1.1.1.1
nameserver 8.8.8.1
Tip: On Ubuntu 22.04,
systemd-resolved
may overwrite/etc/resolv.conf
. To permanently set DNS:
sudo systemctl disable systemd-resolved
sudo systemctl stop systemd-resolved
sudo rm /etc/resolv.conf
echo -e "nameserver 1.1.1.1\nnameserver 8.8.8.8" | sudo tee /etc/resolv.conf
3. Retry the tunnel
cloudflared tunnel run openwebUI
4. Add config.yml
(Important!)
WRN No ingress rules were defined...
You must create ~/.cloudflared/config.yml
: