Tunnel
Share your local Govard project on a public URL without deploying — ideal for client demos, webhook testing, or mobile device checks.
Prerequisites
Install cloudflared on your host:
bash
# Linux (.deb from Cloudflare releases)
curl -fsSL https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb -o /tmp/cloudflared.deb
sudo dpkg -i /tmp/cloudflared.deb
# macOS (Homebrew)
brew install cloudflaredVerify:
bash
cloudflared --versionGovard never bundles cloudflared — you manage its install/upgrade yourself.
Quick Start
bash
# Start a tunnel for the current project (auto-detect URL from cloudflared output)
govard tunnel start
# Or pass an explicit URL you already created
govard tunnel start https://my-demo.trycloudflare.com
# Dry-run: show what would happen without launching
govard tunnel start --planWhile the tunnel is running:
- Govard registers the tunnel domain as a Caddy alias for the project (so Caddy routes it like
*.test, no extra DNS change needed). - The original
Hostheader is kept intact — Magento/Laravel don't see a foreign host and won't redirect. - Framework base URL is rewritten to the tunnel URL via the framework's
BaseURLManager(Magento 2 writesweb/unsecure/base_urletc.). The original URL is restored on stop orCtrl+C.
Stop the tunnel:
bash
govard tunnel stop
# or just Ctrl+C the start processCheck status:
bash
govard tunnel statusFlags
| Flag | Effect |
|---|---|
[url] | Optional tunnel URL. When omitted, Govard parses it from cloudflared stdout. |
--provider <name> | Tunnel provider. Only cloudflare exists today. |
--no-tls-verify | Skip TLS verification for the tunnel endpoint (useful behind corporate proxies). |
--plan | Print the start plan and exit — no process launched. |
How It Works
govard tunnel startresolves the target URL (arg,--urlflag, or auto-detect).- Provider
BuildStartPlancreates a Caddy alias route and a framework base-URL patch plan. - The tunnel process (
cloudflared tunnel --url http://localhost:80or--hello-worldstyle) is spawned. - On exit (requested or interrupted), Govard removes the Caddy alias and reverts the base URL.
Scope:
tunnelrewrites only the primary store/domain. Multi-storestore_domainskeep their.testhosts — they still resolve locally viadnsmasq.
Troubleshooting
| Symptom | Fix |
|---|---|
cloudflared: command not found | Install cloudflared first (see Prerequisites). |
| Tunnel URL shows Govard 404 | Run govard env up first — the project must be running so Caddy has a backend. |
| Base URL not restored after Ctrl+C | Run govard tunnel stop or govard config auto (Magento 2) to re-apply the local URL. |
tunnel status says no tunnel | No active tunnel — tunnel start must be running in another terminal. |