Domains, LAN URLs and passwords
Every app gets two addresses:
| URL | Works from |
|---|---|
https://myapp.example.com |
anywhere, through the Cloudflare tunnel |
https://myapp.your-mac.local |
your LAN, advertised over Bonjour, with Caddy's local certificate |
your-mac is the Mac's local hostname (System Settings → General → Sharing).
To get a padlock on LAN URLs on the Mac itself, run berth trust-ca. On your
other devices, install ~/.berth/caddy/pki/authorities/local/root.crt as a
trusted certificate.
Custom domains
berth domains:add myapp www.mysite.com
berth domains:list myapp
berth domains:remove myapp www.mysite.com
Anything under your main domain just works. For a domain in another zone on your Cloudflare account, log in to that zone once (it opens the browser) and then add it:
berth cf:login mysite.com
berth domains:add myapp www.mysite.com
berth domains:add myapp mysite.com # the bare domain works too
If you added a domain before its zone was connected, run the same
domains:add again after cf:login to create its DNS record.
Berth creates the DNS record and updates the tunnel live. It won't replace a
record that's already there (say www points at your old host) unless you
add --force. If the domain's DNS lives somewhere else, domains:add prints
the record to create (www.mysite.com CNAME <tunnel-id>.cfargotunnel.com),
but the zone still has to be proxied through Cloudflare for the tunnel to
serve it.
LAN-only apps and passwords
berth create admin-tool --repo you/admin-tool --private # LAN only, no public URL
berth auth:set myapp alice:correct-horse-battery # HTTP basic auth, enforced by Caddy
berth auth:unset myapp