Cloudflare Tunnel Setup
Cloudflare Tunnel Setup
Last Updated: 2026-01-28
Status: Production - 17 routes active on NAS
Overview
Cloudflare Tunnel provides secure, public ingress for the BlueFly Agent Platform without opening firewall ports or exposing internal network infrastructure.
Current Configuration
Tunnel Details
- Tunnel Name:
agent-webhook - Tunnel ID:
f6da7bdf-d0f8-4796-a804-afb7984bbe11 - Status: Healthy (7 hours uptime verified 2025-12-26)
- Connector Type:
cloudflared - Running On: Synology NAS (blueflynas.tailcf98b3.ts.net) - PRODUCTION
- Dashboard: https://one.dash.cloudflare.com/
Service Install Token
eyJhIjoiNDlhMGNjZDM2ZTUyYzc5MWRiMjk2MDRlN2ZlM2I3OTMiLCJ0IjoiZjZkYTdiZGYtZDBmOC00Nzk2LWE4MDQtYWZiNzk4NGJiZTExIiwicyI6ImZxdXQvdkJrdlB1UmhjL04wRHd3dWNXK3lDd3NUU1B3Yi9EMDRiTjRWVmM9In0=
Installation
Option 1: Service Install (Recommended)
sudo cloudflared service install eyJhIjoiNDlhMGNjZDM2ZTUyYzc5MWRiMjk2MDRlN2ZlM2I3OTMiLCJ0IjoiZjZkYTdiZGYtZDBmOC00Nzk2LWE4MDQtYWZiNzk4NGJiZTExIiwicyI6ImZxdXQvdkJrdlB1UmhjL04wRHd3dWNXK3lDd3NUU1B3Yi9EMDRiTjRWVmM9In0=
Option 2: Manual Run
cloudflared tunnel run --token eyJhIjoiNDlhMGNjZDM2ZTUyYzc5MWRiMjk2MDRlN2ZlM2I3OTMiLCJ0IjoiZjZkYTdiZGYtZDBmOC00Nzk2LWE4MDQtYWZiNzk4NGJiZTExIiwicyI6ImZxdXQvdkJrdlB1UmhjL04wRHd3dWNXK3lDd3NUU1B3Yi9EMDRiTjRWVmM9In0=
Published Routes
Current Routes (2026-01-28)
| # | Domain | Service | Origin URL | Origin Config | Purpose |
|---|---|---|---|---|---|
| 1 | api.blueflyagents.com | * | https://blueflynas.tailcf98b3.ts.net:3005 | 0 | API Gateway |
| 2 | mesh.bluefly.internal | * | https://blueflynas.tailcf98b3.ts.net:3005 | 0 | Agent Mesh Gateway |
| 3 | nas.blueflyagents.com | * | https://blueflynas.tailcf98b3.ts.net:5001 | 1 (connectTimeout) | NAS Web UI |
| 4 | storage.blueflyagents.com | * | https://blueflynas.tailcf98b3.ts.net:9000 | 0 | MinIO S3 Storage |
| 5 | kagent.blueflyagents.com | * | https://blueflynas.tailcf98b3.ts.net:8080 | 0 | Kagent Service |
| 6 | controller.kagent.blueflyagents.com | * | https://blueflynas.tailcf98b3.ts.net:8083 | 0 | Kagent Controller |
| 7 | mcp.blueflyagents.com | * | https://blueflynas.tailcf98b3.ts.net:4005 | 0 | MCP Server |
| 8 | dashboard.mcp.blueflyagents.com | * | https://blueflynas.tailcf98b3.ts.net:3003 | 0 | MCP Dashboard |
| 9 | router.bluefly.internal | * | https://blueflynas.tailcf98b3.ts.net:4000 | 0 | Agent Router |
| 10 | npm.blueflyagents.com | * | https://blueflynas.tailcf98b3.ts.net:4873 | 0 | NPM Registry |
| 11 | agents.blueflyagents.com | * | https://blueflynas.tailcf98b3.ts.net:3001 | 0 | Agents Service |
| 12 | studio.actprotectiveservices.com | * | https://blueflynas.tailcf98b3.ts.net:0000 | 0 | Studio Service |
| 13 | tracer.bluefly.internal | * | https://blueflynas.tailcf98b3.ts.net:3006 | 0 | Agent Tracer |
| 14 | brain.bluefly.internal | * | https://blueflynas.tailcf98b3.ts.net:6333 | 0 | Agent Brain (Qdrant) |
| 15 | compliance.bluefly.internal | * | https://blueflynas.tailcf98b3.ts.net:3010 | 0 | Compliance Engine |
| 16 | workflow.bluefly.internal | * | https://blueflynas.tailcf98b3.ts.net:3015 | 0 | Workflow Engine |
Notes:
- All routes point to
blueflynas.tailcf98b3.ts.net(Synology NAS) - Origin Config
0= default settings - Origin Config
1= custom connectTimeout
Route Configuration
No CIDR routes configured yet
No hostname routes configured yet
Configuration Files
Local Config Location
- Config File:
~/.cloudflared/config.yml - Credentials:
~/.cloudflared/f6da7bdf-d0f8-4796-a804-afb7984bbe11.json
Example Config (Current Production Configuration)
# ARCHITECTURE: Production on Synology NAS # Cloudflare Tunnel routes to NAS services via Tailscale MagicDNS # All services run on blueflynas.tailcf98b3.ts.net # Production deployment - always-on infrastructure tunnel: f6da7bdf-d0f8-4796-a804-afb7984bbe11 credentials-file: /etc/cloudflared/f6da7bdf-d0f8-4796-a804-afb7984bbe11.json ingress: # API Gateway - hostname: api.blueflyagents.com service: https://blueflynas.tailcf98b3.ts.net:3005 # Agent Mesh Gateway - hostname: mesh.bluefly.internal service: https://blueflynas.tailcf98b3.ts.net:3005 # NAS Web UI (with connectTimeout) - hostname: nas.blueflyagents.com service: https://blueflynas.tailcf98b3.ts.net:5001 originRequest: connectTimeout: 30s noTLSVerify: true # Storage (MinIO S3) - hostname: storage.blueflyagents.com service: https://blueflynas.tailcf98b3.ts.net:9000 # Kagent Services - hostname: kagent.blueflyagents.com service: https://blueflynas.tailcf98b3.ts.net:8080 - hostname: controller.kagent.blueflyagents.com service: https://blueflynas.tailcf98b3.ts.net:8083 # MCP Services - hostname: mcp.blueflyagents.com service: https://blueflynas.tailcf98b3.ts.net:4005 - hostname: dashboard.mcp.blueflyagents.com service: https://blueflynas.tailcf98b3.ts.net:3003 # Agent Router - hostname: router.bluefly.internal service: https://blueflynas.tailcf98b3.ts.net:4000 # NPM Registry - hostname: npm.blueflyagents.com service: https://blueflynas.tailcf98b3.ts.net:4873 # Agents Service - hostname: agents.blueflyagents.com service: https://blueflynas.tailcf98b3.ts.net:3001 # Agent Tracer - hostname: tracer.bluefly.internal service: https://blueflynas.tailcf98b3.ts.net:3006 # Agent Brain (Qdrant) - hostname: brain.bluefly.internal service: https://blueflynas.tailcf98b3.ts.net:6333 # Compliance Engine - hostname: compliance.bluefly.internal service: https://blueflynas.tailcf98b3.ts.net:3010 # Workflow Engine - hostname: workflow.bluefly.internal service: https://blueflynas.tailcf98b3.ts.net:3015 # Studio Service - hostname: studio.actprotectiveservices.com service: https://blueflynas.tailcf98b3.ts.net:0000 # Catch-all (must be last) - service: http_status:404
How It Works
GitLab SaaS / External Clients
HTTPS POST
Cloudflare DNS (mesh.bluefly.internal, api.blueflyagents.com)
Cloudflare Edge (TLS, WAF, DDoS protection)
(OUTBOUND tunnel from always-on infrastructure)
cloudflared (running on GL-iNet router or Vast.ai instance)
http://agent-mesh.tailcf98b3.ts.net:3005 (Agent-Mesh Service - always-on)
CRITICAL: Agents MUST work without home computer. Cloudflare Tunnel is migrating to always-on infrastructure (GL-iNet router or Vast.ai instance). Agent-mesh service is migrating to always-on infrastructure (Vast.ai or dedicated server).
Key Properties:
cloudflaredmakes OUTBOUND connection to Cloudflare- No inbound ports opened on network
- No router/NAT/port forwarding involved
- Domain never resolves to your public IP
- Works from anywhere (home, hotel, coffee shop, LTE, Starlink)
Verification
Check Tunnel Status
cloudflared tunnel list
Expected Output:
NAME ID STATUS
agent-webhook f6da7bdf-d0f8-4796-a804-afb7984bbe11 HEALTHY
Check Tunnel Info
cloudflared tunnel info agent-webhook
Test Routes
# Test GitLab webhook endpoint curl https://api.blueflyagents.com/health # Test NAS access curl https://nas.blueflyagents.com
Verify DNS
# Should resolve to Cloudflare (not your home IP) dig api.blueflyagents.com dig nas.blueflyagents.com
Troubleshooting
Tunnel Not Connecting
- Check
cloudflaredis running:ps aux | grep cloudflared - Check tunnel status:
cloudflared tunnel list - Verify credentials file exists
- Check Cloudflare Dashboard for tunnel status
Routes Not Working
- Verify routes in Cloudflare Dashboard
- Check service URLs are correct (
localhost:3847, notlocalhost:3000) - Verify services are running on correct ports
- Check Cloudflare Dashboard Tunnels Routes
Service URL Issues
Common Error: Service URL points to wrong port or hostname
Fix: Update in Cloudflare Dashboard:
- Go to https://one.dash.cloudflare.com/
- Navigate to Tunnels agent-webhook
- Edit routes
- Update service URL to correct value (e.g.,
http://localhost:3847)
Security Best Practices
- Service URL Uses Tailscale MagicDNS: Routes to
agent-mesh.tailcf98b3.ts.net:3005(always-on infrastructure) - No Port Forwarding: Cloudflare Tunnel eliminates need for port forwarding
- TLS Termination: Cloudflare handles TLS, service can use HTTP
- WAF Protection: Cloudflare provides WAF and DDoS protection
- Access Control: Use Cloudflare Access for additional security if needed
Adding New Routes
Via Cloudflare Dashboard
- Go to https://one.dash.cloudflare.com/
- Navigate to Tunnels agent-webhook
- Click "Configure" "Public Hostnames"
- Add new route:
- Subdomain: Your subdomain
- Domain: blueflyagents.com
- Service:
http://localhost:PORTorhttps://IP:PORT
Via Config File
Edit ~/.cloudflared/config.yml:
ingress: - hostname: new-service.blueflyagents.com service: http://localhost:PORT # ... existing routes ...
Then restart tunnel:
cloudflared tunnel run agent-webhook
Related Documentation
- Webhook System - GitLab webhook architecture
- Cloudflare README - Cloudflare documentation index
- Network Overview - Network architecture
- Network Inventory - Complete inventory