ComfyUI Public Server
Share your local ComfyUI via a Cloudflare Quick Tunnel with an optional password gate
ComfyUI Public Server
<p align="center"> <img alt="License" src="https://img.shields.io/github/license/tngklp/comfyui_public-server"> <img alt="Tunnel" src="https://img.shields.io/badge/Tunnel-Cloudflare_Quick_Tunnel-blue"> </p>Share your local ComfyUI with anyone, anywhere, using a free Cloudflare Quick Tunnel (*.trycloudflare.com), with an optional password gate enforced by a local reverse proxy.
Visitor ──► https://*.trycloudflare.com ──► 127.0.0.1:8288 ──► 127.0.0.1:8188
cloudflared auth proxy ComfyUI
- cloudflared creates the tunnel to Cloudflare's edge and forwards traffic to your local proxy.
- auth proxy (runs locally, on
127.0.0.1:8288) shows visitors a simple password login page before anything reaches ComfyUI. No password configured ⇒ open. - ComfyUI never binds publicly. Your normal local
:8188access is unchanged and password-free.
⚠️ Security consent
Sharing creates a public URL that exposes your entire ComfyUI to anyone who has it including your workflows, models, and file access. Only share with people you trust, and set a password. The web UI shows this warning and requires an acknowledgement before the tunnel can be started.
Features
- One-click Start / Stop and copy URL
- Optional user-set password (empty ⇒ no password / open tunnel)
- Server-side password protection
- Auto-downloads the correct
cloudflaredbinary for your OS on first use - Clean shutdown: the tunnel stops when ComfyUI exits
Install
-
Clone this repository into your ComfyUI custom nodes folder:
cd ComfyUI/custom_nodes git clone https://github.com/tngklp/comfyui_public-server.git -
Restart ComfyUI. A "Public Server" button appears in the top bar menu.
-
The extension downloads
cloudflaredautomatically (first run only), this can take a moment.
Requires an internet connection and that ComfyUI is reachable at
127.0.0.1:8188(the default). ComfyUI already shipsaiohttp, which is the only runtime dependency.
Usage
- Click Public Server in ComfyUI's menu.
- Read and acknowledge the security warning.
- Optionally enter a password and click Save password.
- Click Start. After a few seconds a
https://….trycloudflare.comURL appears — click Copy URL and send it to someone. - Stop when done. (Also stops automatically if ComfyUI exits.)
Visitors will be asked for the password (if set) and then land on your normal ComfyUI interface, with live queue updates over WebSocket.
Configuration
Environment variables (optional). Set them before launching ComfyUI.
| Variable | Default | Purpose |
|----------|---------|---------|
| PUBLICSERVER_TARGET_URL | http://127.0.0.1:8188 | Local ComfyUI address to forward to |
| PUBLICSERVER_PROXY_HOST | 127.0.0.1 | Proxy bind host (keep loopback) |
| PUBLICSERVER_PROXY_PORT | 8288 | Proxy bind port |
| PUBLICSERVER_PASSWORD | (none) | Default password (overrides saved one) |
| PUBLICSERVER_AUTOSTART | 0 | Set 1 to auto-start the tunnel on boot |
| PUBLICSERVER_BINARY_DIR | <package>/bin | Where to cache the cloudflared binary |
The password can also be set at runtime from the UI/API; it is persisted to settings.json next to the package.
REST API
All under the ComfyUI origin (same host/port as the web UI), no auth:
| Method | Path | Description |
|--------|------|-------------|
| GET | /publicserver/status | {running,state,url,password_set,password,error,tunnel_log,…} |
| POST | /publicserver/start | Start proxy + tunnel (returns immediately; poll status) |
| POST | /publicserver/stop | Stop tunnel + proxy |
| POST | /publicserver/password | Body {"password": "…"} (empty clears) |
Example:
curl http://127.0.0.1:8188/publicserver/status
curl -X POST http://127.0.0.1:8188/publicserver/start
TryCloudflare caveats
- The URL is random and changes every time you start.
- Capped at ~200 concurrent in-flight requests, no SLA/uptime guarantee.
- If you have a
config.yamlin your default cloudflared directory, quick tunnels can be blocked. This extension sidesteps that by pointing cloudflared at its own empty config.
Troubleshooting
- "Timed out waiting for cloudflared" / URL never appears: Check the
tunnel_login/publicserver/status; likely a firewall, proxy, or offline situation. Trycloudflareddownload again by deleting thebin/folder. - Port 8288 in use: Set
PUBLICSERVER_PROXY_PORTto a free port. - Binary download fails: Check internet access; you can also install
cloudflaredmanually and it will still be used if present on PATH (or place a binary at<package>/bin/cloudflared(.exe)).