A stable URL with Cloudflare
A named tunnel gives hytte a fixed address like https://chat.example.com. Your server needs no open ports and no public IP, and Cloudflare provides the certificate. Because the hostname stays the same, passkeys and security keys work, unlike with a quick tunnel.
You need a domain (any registrar) and a free Cloudflare account.
1. Put the domain on Cloudflare
Section titled “1. Put the domain on Cloudflare”- Sign up at dash.cloudflare.com and choose Add a domain (it may also say Onboard a domain). Pick the Free plan.
- Cloudflare shows two nameservers. At your registrar, replace the domain’s nameservers with those two.
- Wait until Cloudflare marks the domain Active. That usually takes minutes, sometimes a few hours, and Cloudflare emails you when it’s done.
2. Create the tunnel
Section titled “2. Create the tunnel”- In the dashboard, open Networking → Tunnels (in the Zero Trust dashboard it’s Networks → Tunnels). Zero Trust may ask for a team name the first time and, even on the free plan, for a payment method.
- Create a tunnel, choose Cloudflared, and give it a name, e.g.
hytte. - Cloudflare shows install commands that contain a long token (the part after
--tokenorservice install). Copy the token. You don’t need to run the commands, because hytte startscloudflareditself.
3. Route your hostname to hytte
Section titled “3. Route your hostname to hytte”In the tunnel, add a route of type Published application (older dashboards call it Public hostname):
| Field | Value |
|---|---|
| Subdomain | chat |
| Domain | example.com |
| Service | HTTP → localhost:8000 |
If hytte runs with -s (self-signed HTTPS), use HTTPS → localhost:8000 and turn on No TLS Verify under the TLS settings. Cloudflare creates the DNS record for the hostname.
4. Run hytte
Section titled “4. Run hytte”Install cloudflared, then:
export HYTTE_TUNNEL_TOKEN=eyJh… # the token from step 2hytte -b 127.0.0.1 --domain chat.example.comThe token implies --tunnel and requires --domain. Pass it through the environment rather than --tunnel-token, so it doesn’t show up in ps. With the systemd package, set both in /etc/default/hytte:
HYTTE_OPTS="-b 127.0.0.1 --domain chat.example.com"HYTTE_TUNNEL_TOKEN=eyJh…In Docker, run cloudflared as a sidecar instead. See the Compose example, where the service is http://hytte:8000.
Open https://chat.example.com. Create the first account with hytte -u NAME (same -d) and use the printed path with your hostname.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Likely cause |
|---|---|
cloudflared is required for --tunnel-token |
cloudflared isn’t installed or not on PATH for the hytte user. |
| Cloudflare error 1033 | The tunnel isn’t connected: hytte isn’t running, or the token is wrong. |
| Error 502 / Bad gateway | Wrong service in the route: check the port, and HTTP vs HTTPS (with No TLS Verify for -s). |
| 404 from Cloudflare | The hostname doesn’t match a route of this tunnel. |
| Domain still Pending | The nameservers at the registrar aren’t Cloudflare’s yet. |
| Passkeys not offered | --domain doesn’t match the hostname in the browser exactly. |