Publish preview (Cloudflare Quick Tunnel)
In the Dev module, the Preview tab can expose your local development server to the Internet through a Cloudflare Quick Tunnel (*.trycloudflare.com). Useful for demos, webhooks, or mobile testing - not production hosting.
No Cloudflare account is required. Navin runs cloudflared (from PATH, or downloaded once into the instance data directory).
Auto-open Preview
When the agent scaffolds or starts a web app, it calls open_preview after the
local server responds (curl). The Preview iframe opens with that URL
automatically - no manual Open click. For Android, mobile(action="preview_start")
opens the Mobile tab the same way. Publish (public tunnel) stays manual.
On a narrow screen (phone), the Dev chat becomes a bottom sheet so Preview can use the full width; auto-open also collapses the chat so the app stays in focus.
Usage
-
Start a dev server in the project (
npm run dev, etc.) - or let the agent do it. -
Open Preview (auto-opened when the agent calls
open_preview) and confirm the local URL (e.g.http://127.0.0.1:5173). -
Click Publish next to Open.
-
Navin reads the port from that URL (it often changes on every Vite/Next start) and runs:
cloudflared tunnel --url http://127.0.0.1:<port> \ --http-host-header 127.0.0.1:<port> --no-autoupdate -
The public URL (
https://….trycloudflare.com) appears: copy, open, or Stop.
The tunnel rewrites the Host header to 127.0.0.1:<port>, so Vite / Next / etc. do not need allowedHosts in their config.
Requirements: Internet access. Publishing is localhost-only (same machine as the gateway). On first use, the cloudflared binary may be downloaded automatically.
What it is not
| Expectation | Reality |
|---|---|
| Permanent production hosting | No - temporary tunnel to your machine |
Custom domain mysite.com | No - random *.trycloudflare.com URL |
| Cloudflare account required | No |
Do I need a Cloudflare account?
| Goal | Cloudflare account? |
|---|---|
| Quick share via Publish (Quick Tunnel) | No |
| Your domain / subdomain | Yes - named Cloudflare tunnel, out of current scope |
Gateway API
Authenticated routes (Authorization: Bearer …), localhost controls only:
| Route | Role |
|---|---|
GET /api/webui/preview-tunnel | Status (active, port, URL) |
GET /api/webui/preview-tunnel/start?port=5173 | Start cloudflared and wait for the public URL |
GET /api/webui/preview-tunnel/stop | Stop the tunnel |
Implementation: navin/webui/preview_tunnel_api.py. The tunnel is stopped when the gateway shuts down.
Troubleshooting
| Message | Likely cause | Hint |
|---|---|---|
This host is not allowed (Vite) | Older tunnel without Host rewrite | Stop, then Publish again (Navin sends Host: 127.0.0.1) |
could not download cloudflared | Network / GitHub unreachable | Check Internet, or install cloudflared on PATH |
Nothing is listening on that local port | Dev server not running | Start the server, publish again |
Enter a local URL with a port | URL without an explicit port | e.g. http://127.0.0.1:5173 |
preview tunnel is localhost-only | Remote gateway access | Publish from the machine running Navin |
Related
- Workbench - Preview / Browser panel
- Cloudflare TryCloudflare