Acap Punya Knowledge Base

Simple wiki for notes, guides, commands.

← Back to search

Cloudflare Tunnel Quick Notes

2026-03-18 21:44 • #cloudflared #tunnel #homelab

1. Adding new service to the tunnel via config.yml first.

Example:

tunnel: YOUR-TUNNEL-ID
credentials-file: /home/pi/.cloudflared/YOUR-TUNNEL-ID.json

ingress:
  # SSH access
  - hostname: ssh.domain.com
    service: ssh://localhost:22
  # Website
  - hostname: domain.com
    service: http://localhost:80
  # Catch-all (must always be last)
  - service: http_status:404

2. Restart Tunnel to apply changes.

systemctl restart cloudflared

3. Create DNS via command below.

cloudflared tunnel route dns <your-host> <domain/subdomain>

4. Client: Forward Custom port to localhost using tunnel

#!/bin/bash
cloudflared access tcp --hostname <domain/subdomain> --url 127.0.0.1:<port-number>