Turn Your Own Machine Into a Public API Server (For Free) Using Cloudflare Tunnel
Описание и применение
Разверните локальный API в публичный сервер без проброса портов, используя Cloudflare Tunnel.
Задача
Expose a local API to the internet without port forwarding, firewall changes, or cloud deployment.
Результат
Local FastAPI server is securely exposed to the internet via Cloudflare Tunnel without opening inbound ports or changing firewall settings.
Рабочий процесс
- Install cloudflared via brew
- Log in with cloudflared tunnel login
- Create a tunnel with cloudflared tunnel create my-tunnel
- (Optional) Map a domain with cloudflared tunnel route dns my-tunnel api.yourwebsite.com
- Create ~/.cloudflared/config.yml with tunnel ID, credentials file, and ingress rules
- Run the tunnel with cloudflared tunnel run my-tunnel
- (Optional) Use launchctl on macOS to keep the tunnel alive
Доказательства
cloudflared connects out to Cloudflare, so your router and firewall stay closed.
No domain? For quick tests, cloudflared tunnel --url http://localhost:8000 gives you a temporary trycloudflare.com address instead.
- Дата записи: 2026-10-25T04:11:09.967Z