DNS and Cloudflare
This page explains the hostname model of a Docker install with TLS and exactly which DNS records and Cloudflare settings it needs. The installer verifies all of this before it starts the stack. See One-click install for the install flow and Installer options for the full flag reference.
Domain model
Section titled “Domain model”An install uses a few distinct names.
| Name | Installer input | Default | Purpose |
|---|---|---|---|
| Base domain | OPENFLARE_BASE_DOMAIN (required) |
none | Root domain you own. Defaults the other names. |
| Worker base domain | OPENFLARE_WORKER_BASE_DOMAIN |
the base domain | Zone under which every worker gets a hostname (<name>.<worker-base>). |
| Console host | OPENFLARE_CONSOLE_HOST |
console.<base> |
Where you open the web console. |
| API host | OPENFLARE_API_HOST |
none (optional) | Public host for the internal plane API used by remote cells. Only needed if you run remote cells. --no-api-host clears it. |
| Webhook host | OPENFLARE_GITHUB_WEBHOOK_HOST |
hooks.<base> when git push deploy is enabled |
Receives GitHub webhooks. |
Worker hostnames
Section titled “Worker hostnames”A worker hostname is exactly one label below the worker base domain. With worker base domain example.com, demo.example.com is valid, while demo.apps.example.com is not. Hostnames are globally unique; creating a duplicate returns HTTP 409.
A wildcard record *.example.com matches one label only. It does not match example.com itself (the apex) or deeper names such as a.b.example.com. The apex is not routed to workers and is not in the wildcard certificate.
Reserved labels
Section titled “Reserved labels”Some labels can never be used as worker hostnames, so they cannot collide with infrastructure names. The default list is:
console, api, www, mail, smtp, imap, pop, auth, admin, status, traefik, dashboard, hooks
Override it with --reserved-worker-labels (installer persists it as PLANE_RESERVED_WORKER_LABELS). Each label must match ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$, no whitespace is allowed, and duplicates are removed. The control plane rejects reserved labels when a worker or hostname is created. The edge also excludes <label>.<worker-base> from the tenant route.
If your console, API or webhook host is a single label directly under the worker base domain, the installer automatically adds that label to the reserved list. If it is multi-level under the worker base domain (for example console.admin.example.com with worker base example.com), the installer fails with E_HOST_CONFLICT. Pick a single-label host, or use a different worker base domain.
Hostname rules
Section titled “Hostname rules”Every host you give the installer is normalized and validated:
- Lowercase, no trailing dot, no scheme, path, port or whitespace.
- No empty labels, no underscore, no
*. - Each label 1 to 63 characters, no leading or trailing hyphen; total length at most 253.
- Non-ASCII names are converted to punycode.
- IP addresses are rejected.
Additional rules:
- The console host must be a fully qualified name (not
localhost) and must not equal the base domain or worker base domain. - The API host must differ from the console host and must not be an apex.
- The webhook host must differ from the console and API hosts.
One zone or two
Section titled “One zone or two”By default the worker base domain equals the base domain, so one Cloudflare zone covers everything. You can split workers into their own zone, for example base example.com and worker base example-apps.com.
When the zones differ, the installer needs access to both, and each zone gets its own wildcard certificate (see TLS and certificates). If the console or API host lies outside the worker base domain, you must create its exact A record yourself; the installer never creates it.
DNS records you must create
Section titled “DNS records you must create”The minimum is a single record in the worker base domain zone:
| Type | Name | Content | Proxy status |
|---|---|---|---|
A |
* |
your server’s public IPv4 | DNS only or Proxied |
That one wildcard covers the console host, the API host and the webhook host as long as they sit under the worker base domain. Exact A records for the console or API host are optional in that case. If you do create one, it must be a single A record that equals the server’s public IP.
Rules the installer enforces:
- Exactly one wildcard
Arecord. SeveralArecords on the wildcard fail the check. - No
AAAArecord on the wildcard or on an exact console/API host. The installer fails withE_IPV6_UNSUPPORTED(“remove the AAAA record and re-run”). - No
CNAMEat the wildcard or exact hosts. This fails withE_CLOUDFLARE_DNS. - If you have CAA records, they must authorize
letsencrypt.org(or the CA you configured), otherwise the check fails withE_CLOUDFLARE_CAA.
The server’s public IPv4
Section titled “The server’s public IPv4”The installer detects the address by asking api.ipify.org, ipv4.icanhazip.com and ifconfig.me, and needs at least two agreeing answers. It then requires the address to be assigned to a local interface. Hosts behind NAT, or with split-horizon addressing, are rejected unless you set the address explicitly with --public-ipv4 (or OPENFLARE_PUBLIC_IPV4). The address must be globally routable; private, CGNAT, link-local, documentation and reserved ranges fail with E_IPV4.
Set Full (strict) up front
Section titled “Set Full (strict) up front”Set the zone’s SSL/TLS encryption mode to Full (strict) (Cloudflare dashboard → SSL/TLS → Overview) before you install, whatever mode you plan to run. Do this even if every record is DNS only.
- It costs nothing in DNS-only mode. Grey-cloud records never pass through Cloudflare, so the setting has no effect on them.
- It is a one-time, zone-wide switch. Once set, you can turn a record to Proxied at any later time without hitting the redirect loop that Flexible or Full (non-strict) cause against an origin that serves HTTPS.
- It keeps switching modes a single step. Without it, moving to proxied means first going to Cloudflare to change another setting, then coming back.
Both modes run fine under Full (strict); only proxied mode depends on it. The installer enforces it in every mode: if the zone is not on Full (strict) it stops with E_CLOUDFLARE_SSL before changing anything. Universal SSL, by contrast, is only checked when a zone has proxied records.
DNS-only versus proxied mode
Section titled “DNS-only versus proxied mode”Each record can be DNS only (grey cloud) or Proxied (orange cloud). The installer works out the edge mode from your records: dns-only (no proxied target), proxied (all proxied) or mixed.
| DNS only | Proxied | |
|---|---|---|
| Traffic path | Client connects directly to your server | Client connects to Cloudflare, which connects to your server |
| Public resolution must be | exactly your public IPv4, no CNAME | inside Cloudflare’s edge IPv4 ranges, and not your origin IP |
| Client IP at the edge | Traefik does not trust forwarded headers | Traefik trusts X-Forwarded-For only from Cloudflare’s ranges |
| Extra requirements | none | Full (strict) SSL, active Universal SSL, firewall open to Cloudflare |
Requirements for proxied mode
Section titled “Requirements for proxied mode”The installer checks all of these and refuses to continue otherwise. Items 1 and 3 are the same prerequisites as above; setting Full (strict) early means they already hold:
- The zone uses a full setup (not a partial or CNAME setup):
E_CLOUDFLARE_ZONE. - Universal SSL is enabled and has an active certificate pack:
E_CLOUDFLARE_SSL. - The zone SSL/TLS encryption mode is Full (strict) (
strict). Flexible, Off and Full (non-strict) are rejected. - Cloudflare’s IPv4 ranges can be fetched (
E_CLOUDFLARE_IP_RANGES). They are written into the Traefik static config as trusted proxy addresses. - Your origin firewall allows Cloudflare’s ranges on ports 80 and 443.
To check that your origin presents the expected certificate directly, bypassing Cloudflare:
openssl s_client -connect <origin-ip>:443 -servername console.example.comCloudflare API tokens
Section titled “Cloudflare API tokens”The installer needs two Cloudflare API tokens, and the same tokens are used by Traefik for DNS-01 renewals.
| Token | Required permission | Used for |
|---|---|---|
Zone token (OPENFLARE_CLOUDFLARE_ZONE_API_TOKEN) |
Zone Read | Finding the zone, and reading SSL settings |
DNS token (OPENFLARE_CLOUDFLARE_DNS_API_TOKEN) |
DNS Edit (shown as “DNS Write” in token policies), scoped to the target zone | Reading and writing records, and ACME DNS-01 TXT records |
Recommended layout: a token with Zone Read and a second token with DNS Edit restricted to the zone(s) you use. Make sure at least one token can also read SSL settings (the “SSL and Certificates Read” or Zone Settings Read permission), because the installer checks the SSL mode (and, for proxied zones, Universal SSL) with the zone token and falls back to the DNS token on a 401 or 403. If neither can read them, the error asks you to verify manually.
How you provide them:
- Only through environment variables or the hidden interactive prompt. The
--cloudflare-*-tokenflags are refused withE_CLIbecause command-line arguments are visible to other users. - Both tokens are checked against Cloudflare’s token verification endpoint; a disabled or expired token fails with
E_CLOUDFLARE_TOKEN. - When Cloudflare exposes the token’s policies, the installer also checks for Zone Read and DNS Write and fails with
E_CLOUDFLARE_PERMISSIONif they are missing.
export OPENFLARE_CLOUDFLARE_ZONE_API_TOKEN='...'export OPENFLARE_CLOUDFLARE_DNS_API_TOKEN='...'The installer stores them as 0600 files in $OPENFLARE_CONFIG_ROOT/secrets/ (cloudflare_zone_api_token, cloudflare_dns_api_token), mounted into Traefik as CF_ZONE_API_TOKEN_FILE and CF_DNS_API_TOKEN_FILE.
Verify mode versus create mode
Section titled “Verify mode versus create mode”Verify mode is the default. The installer reads Cloudflare and checks: one active, unpaused, full-setup zone; the wildcard record; its proxied state; absence of AAAA and CNAME; console and API records; CAA; and, for proxied mode, Universal SSL and the SSL mode. It changes nothing.
Create mode lets the installer manage the wildcard for you. Enable it with --create-dns (also --create-dns-records) or OPENFLARE_CREATE_DNS_RECORDS=1; --no-create-dns-records turns it off.
- It creates or updates only the wildcard
*.<worker-base>Arecord. - A newly created record is DNS only. When it updates an existing record, the proxied state you chose is preserved.
- It never touches exact records, including the apex and the console or API hosts.
- It prints a diff first (for example
create A ...orupdate A ... (preserved)). - On a terminal it asks you to type
yes. Non-interactively you must pass--yes, otherwise the run fails withE_DNS_CONFIRMATION. - It supports a dry run.
- Mutations are retried up to three times. After an ambiguous response it re-reads Cloudflare state, and it fails closed on conflicts. If retries are exhausted, re-run the installer to reconcile.
--skip-dns-check skips verification and marks the result DNS_CHECK_SKIPPED. Use it only when you know the records are right.
Propagation checks
Section titled “Propagation checks”After the records pass the API checks, the installer probes real DNS using random names such as install-probe-<hex>.<worker-base>, plus the console host (and API host if set):
- An authoritative query against the zone’s Cloudflare nameservers using
dig, ifdigis installed (4 attempts, 2 seconds apart). - A recursive query through DNS-over-HTTPS (6 attempts, 5 seconds apart).
In DNS-only mode the answer must be exactly your public IPv4. In proxied mode it must fall inside Cloudflare’s edge ranges and must not be your origin address. A failure is reported as E_DNS_PROBE.
You can reproduce this yourself:
dig +short console.example.comdig +short anything.example.comdig +short @<cloudflare-nameserver> anything.example.comTroubleshooting
Section titled “Troubleshooting”| Error | Likely cause | Fix |
|---|---|---|
E_IPV6_UNSUPPORTED |
An AAAA record exists on the wildcard or console/API host |
Delete the AAAA record and re-run |
E_CLOUDFLARE_DNS |
Missing wildcard, several A records, a CNAME, or an exact record that differs from the public IP |
Make the wildcard a single A record equal to the public IP |
E_CLOUDFLARE_ZONE |
Zone not found, inactive, paused, found more than once, or not a full setup | Activate the zone with Cloudflare nameservers |
E_CLOUDFLARE_SSL |
Proxied mode with Universal SSL off, no active cert pack, or mode not Full (strict) | Enable Universal SSL and set SSL/TLS to Full (strict) |
E_CLOUDFLARE_CAA |
CAA records do not authorize the CA | Add a CAA record for letsencrypt.org (or your private CA) |
E_CLOUDFLARE_TOKEN / E_CLOUDFLARE_PERMISSION |
Token disabled, expired or too narrow | Recreate the token with the scopes above |
E_PUBLIC_IP / E_IPV4 |
Detection disagreed, address not local, or not public | Pass --public-ipv4, or fix NAT |
E_DNS_PROBE |
Record not yet propagated, or proxied state does not match expectations | Wait and re-run; compare dig output with the table above |
E_HOST_CONFLICT |
Console, API or webhook host is multi-level under the worker base domain | Use a single-label host |
Next steps
Section titled “Next steps”- TLS and certificates covers how the wildcard and exact certificates are issued.
- Local hostnames covers development without real DNS.
- Services and ports lists what listens where.