Cloudflare Proxied Domains
Reoclo’s managed proxy (Caddy) issues certificates automatically. By default it uses the HTTP-01 challenge, which needs Let’s Encrypt to reach your server directly. When a domain is behind Cloudflare’s proxy (the orange cloud), that path does not work reliably.
With a Cloudflare API token, Reoclo switches those domains to the DNS-01 challenge. Caddy publishes a TXT record through the Cloudflare API, Let’s Encrypt reads it from DNS, and the certificate is issued without a direct connection.
Prerequisites
Section titled “Prerequisites”- A server connected with the Reoclo runner, with the managed proxy enabled (server page, Proxy tab).
- A Cloudflare account that manages the zone (for example
example.com). - An admin role in your organisation (the DNS providers page needs the servers edit-settings permission).
Step 1: Create the API token in Cloudflare
Section titled “Step 1: Create the API token in Cloudflare”- In the Cloudflare dashboard, open My Profile > API Tokens > Create Token. Account API tokens work too (Manage Account > API Tokens).
- Choose Create Custom Token.
- Add these permissions:
- Zone > Zone > Read
- Zone > DNS > Edit
- Under Zone Resources, select Include > Specific zone and pick the zone. Do not grant all zones.
- Optional: under Client IP Address Filtering, add the public IP addresses of the Reoclo servers that will use the token. Add both the IPv4 address and the IPv6 prefix (the /64). A server with IPv6 connects to Cloudflare over IPv6, so an IPv4-only filter blocks it. To see the address Cloudflare sees, run this on the server:
curl -s https://api.cloudflare.com/cdn-cgi/trace | grep ip=. Reoclo verifies the token from those servers, so a token restricted to other addresses fails verification. - Create the token and copy it. Cloudflare shows it only once.
The two permissions above are all DNS-01 needs. Features such as cache purge and Cloudflare protection warnings use more, all optional. See Optional token permissions.
Step 2: Set the Cloudflare SSL/TLS mode
Section titled “Step 2: Set the Cloudflare SSL/TLS mode”In the zone’s SSL/TLS settings, select Full (strict). Your server will hold a valid certificate, so strict mode is safe. Flexible mode sends plain HTTP to your server and breaks redirects. Until you link the domain in Step 4, strict mode shows error 526 for it.
Step 3: Add the token in Reoclo
Section titled “Step 3: Add the token in Reoclo”- In Reoclo, open Domains > DNS Providers.
- Select Add provider.
- Enter a label and paste the token.
- Select the servers the token may be used from. Nothing is pre-selected: the token is a secret, so servers are opted in. If the token has an IP restriction, select only the servers whose IPs you allowed.
- Select Add and verify.
Reoclo sends the token to each selected server and runs three checks from there: the token is active, the token can read at least one zone, and the token can create a DNS record. The last check creates a TXT record named _reoclo-dns-check.<zone> and deletes it immediately.
When at least one server passes, the provider shows active and lists the zones the token covers. Each server shows its own result. A failed server shows the reason, for example “Cloudflare rejected the token from server web-2. If the token has a client IP restriction, add this server’s public IPv4 and IPv6 addresses.”
You can add more than one token. When two active tokens on the same server cover the same zone, Reoclo uses the most recently added token. Reoclo shows an “Also covered by” hint on those tokens. Tokens on different servers can cover the same zone without conflict. You can give each server its own token with a client IP restriction.
To rotate a token, open Edit on the provider and paste the replacement into Replace API token. Reoclo verifies the replacement from the assigned servers first and only swaps it when the checks pass; a failing replacement leaves the current token in place.
Wildcard domains (*.example.com) on the managed proxy need this token. HTTP-01 cannot issue a wildcard certificate. Reoclo waits to serve a wildcard domain until you assign a token that covers its zone to the server.
Step 4: Add the domain
Section titled “Step 4: Add the domain”Add and verify the domain as described in Custom Domains. Keep the orange cloud on.
On the domain page, the Routing card shows Certificate: DNS-01 via Cloudflare (label). The DNS summary shows Proxied via Cloudflare instead of a DNS mismatch.
On the server’s Proxy tab, the route shows a DNS-01 badge. The certificate is usually issued within a minute of the next reconcile.
Let Reoclo write the records
Section titled “Let Reoclo write the records”When a token covers a zone, Reoclo can write the records it expects for a domain in that zone. The token needs the same Zone:DNS:Edit permission as DNS-01.
Reoclo writes only these records:
- The A record for the domain, with the IP address of the linked server.
- The CNAME record, when you set an expected CNAME instead.
- The
_reoclo-verifyTXT record, when verification is pending.
Reoclo never writes other records in the zone.
Create the record when you link a domain
Section titled “Create the record when you link a domain”On the Link domain form, the DNS record on Cloudflare card appears when a token covers the zone. Create the DNS record on Cloudflare is on by default. Reoclo creates the record after it links the domain.
If a record with a different value already exists, Reoclo does not change it. The domain page shows the reason and offers Fix on Cloudflare.
Proxy through Cloudflare is off by default, so the record is DNS-only (gray cloud). If you turn it on, set SSL/TLS to Full (strict) in Cloudflare first.
Fix on Cloudflare
Section titled “Fix on Cloudflare”When a record is missing or points elsewhere, or the last publish failed, Reoclo shows Fix on Cloudflare. It appears on the domain’s DNS tab and on the DNS page. Select it to see the changes before Reoclo makes them:
- Reoclo reads the current records from the zone through one of the servers assigned to the token.
- The preview lists each record with its action: Create, Update, Delete, Unchanged, or Conflict.
- Select Apply on Cloudflare to make the changes.
A Conflict row blocks the apply. The preview shows the reason. Fix the cause in Cloudflare or in the domain settings, then open the preview again.
An update keeps the proxy state of the record. A create uses the Proxy through Cloudflare switch in the preview.
Reoclo records each publish in the audit log with the changes it made. Platform administrators can turn this feature off with the dns_publish feature flag.
Manage other DNS records
Section titled “Manage other DNS records”Besides the records Reoclo writes for your domains, you can add, list and remove TXT, CNAME and MX records in any zone that one of your tokens covers. A DMARC policy is the usual reason: it lives in a TXT record at _dmarc.<your domain>, and it no longer needs a trip to the Cloudflare dashboard.
You need an admin role in your organisation and an active token that covers the zone. You never name a zone ID. Reoclo works out the zone from the record name and uses your own token to write to it. A name outside every zone your tokens cover is refused, and nothing is sent to Cloudflare.
Use the dashboard
Section titled “Use the dashboard”Open DNS in the sidebar and switch to the Records tab. You only see the tab if you can edit domains.
- Pick a zone. The list shows its TXT, CNAME and MX records, and you can filter by type. Long values are cut short in the table; select the arrow beside a value to read all of it, or the copy button to take it with you.
- Select Add record, choose the type, and enter a name. A relative name such as
_dmarcis placed under the selected zone, a full name is used as written, and the form shows the full record name before you save. For a DMARC policy, choose Use DMARC template on a TXT record and change the report address. - To remove a record, select its delete button and confirm. The confirmation names the record, and removal cannot be undone.
Records Reoclo publishes for your domains carry a Managed by Reoclo badge and have no delete button.
The tab does not appear, or explains that DNS records are not available, when a platform administrator has turned DNS publishing off.
Add a DMARC record from the CLI
Section titled “Add a DMARC record from the CLI”$ reoclo dns records add _dmarc.example.com --type TXT \✓ added TXT _dmarc.example.com in example.com (id: 023e105f4ecef8ad9ca31a8372d0c353)
$ reoclo dns records ls _dmarc.example.comID TYPE NAME CONTENT TTL PRIORITY MANAGED023e105f4ecef8ad9ca31a8372d0c353 TXT _dmarc.example.com v=DMARC1; p=none; rua=mailto:[email protected] auto - -To remove a record, pass its ID and the zone it belongs to:
reoclo dns records rm 023e105f4ecef8ad9ca31a8372d0c353 --zone example.comSee reoclo dns for every option.
What Reoclo checks
Section titled “What Reoclo checks”- TXT: up to 2048 characters. Quotes are optional. If you use them, wrap the whole value in one pair, or write quoted segments such as
"part one" "part two". - CNAME: the target must be a hostname, not an IP address. A CNAME cannot sit at the zone root, and it cannot share a name with another record.
- MX: needs a priority from 0 to 65535 and a mail host name.
- TTL:
auto, or 60 to 86400 seconds. - Relative names:
_dmarcneeds the zone it belongs to (--zone example.com). A full name such as_dmarc.example.comdoes not.
Reoclo will not add a record over, or remove, a record it publishes for a domain: the routing record, the _reoclo-verify TXT record, or a certificate challenge record. These show as managed in the list. Change them from the domain’s DNS settings instead.
Every add and remove is recorded in the audit log with who made the change, the zone, the record name and type, and its value. Platform administrators can turn this feature off with the dns_publish feature flag, the same switch as publishing.
Optional token permissions
Section titled “Optional token permissions”DNS-01 and the DNS records need only Zone Read and DNS Edit. The features in Partner Embeds use extra permissions. Add one only for the feature you plan to use. A token without them keeps working for DNS-01, and a feature that lacks its permission tells you which one to add.
Add each as a Zone permission on the token in Cloudflare and keep the token’s zone restriction.
| Permission in Cloudflare | What it enables | Shown in Reoclo as |
|---|---|---|
| Zone > Cache Purge > Purge | Purge the paths you list from Cloudflare’s cache after a deploy | Cache purge |
| Zone > Zone Settings > Read | Read the zone’s Security Level, so the embeddable path warnings can tell you about Under Attack mode | Zone settings read |
| Zone > Bot Management > Read | Read whether Bot Fight Mode is on | Bot management read |
| Zone > Zone WAF > Read | Read your custom rules, so the warnings can tell you when one of them challenges requests | WAF rules read |
| Zone > Zone WAF > Edit | Add and remove the one rule that lets your embeddable paths skip Cloudflare’s challenges | WAF rules write |
| Zone > Cache Rules > Edit | Add and remove the one cache rule that makes Cloudflare respect your Cache-Control | Cache rules write |
Without the read permissions, the embeddable path warnings fall back to a test request from Reoclo and say so. Without the two edit permissions, Allow on Cloudflare and Add cache rule show an error naming the permission to add, and nothing changes in your zone.
Check the permissions in the dashboard
Section titled “Check the permissions in the dashboard”Open Domains > DNS Providers. Each provider has a Permissions list with one row per permission in the last column above, and a Check token permissions button for admins.
The button asks a connected server to try each read permission against the first zone the token covers. It makes no change to your zone, with one exception: Cache purge is tested by purging a URL that does not exist, because a refusal on that call is the only way to detect a missing permission. Each row then shows one of these:
| Row shows | Meaning |
|---|---|
| allowed | Cloudflare accepted the call. The time of the check follows. |
| denied | The token lacks the permission, or it is restricted to other client IPs. |
| not available | Cloudflare answered that the feature is not available on this zone, for example because of its plan. |
| could not check | The call failed for another reason. The reason follows. |
| learned the first time Reoclo uses it | WAF rules write and Cache rules write cannot be proven without writing a rule, so they stay unknown until you use the feature. The first attempt records allowed or denied. |
| not checked yet | Nobody has run the check for this provider. |
A token that covers several zones can differ per zone. The check reads the first zone, and a failure when you use a feature on another zone overrides the stored result. If no connected server can reach Cloudflare with the token, the check says so; verify the token first.
How it works
Section titled “How it works”- Reoclo stores the token encrypted. It never appears in the API, in logs, or in the effective Caddy configuration. Caddy reads it from a file inside its configuration volume at
/etc/caddy/dns/. - The managed proxy image is Caddy with the
caddy-dns/cloudflaremodule. Reoclo moves servers to this image once, with one to two seconds of proxy downtime. Until a server runs it, the route shows “Waiting for this server to run the managed Caddy image” and keeps HTTP-01. - Deleting a provider removes its token files from the servers on the next reconcile. Routes under its zones fall back to HTTP-01.
The Proxy tab runtime strip
Section titled “The Proxy tab runtime strip”The Proxy tab shows the state of the reoclo-caddy container: running since when, the Caddy version, the image, and when it was last observed.
- Start appears when the container is stopped or missing. Reoclo enables the proxy and recreates the container.
- Restart appears when the container is running.
- To stop the proxy, click Change in the reverse proxy section, select None, then click Confirm. A plain container stop is undone on the next reconcile. This removes the proxy container and the volumes Reoclo created for it (
reoclo-caddy-dataandreoclo-caddy-config), including issued certificates. Certificates are issued again after you enable the proxy. Reoclo never deletes a volume it did not create. A server whose proxy still runs on the oldercaddy_dataandcaddy_configvolumes keeps them when you stop the proxy, and you can remove them yourself withdocker volume rmonce you no longer need them.
Troubleshooting
Section titled “Troubleshooting””No DNS provider covers this zone”
Section titled “”No DNS provider covers this zone””No active token lists this domain’s zone. Check the zones on the provider. If the zone is missing, the token was created for a different zone; create a new token with the correct zone and add it.
”A DNS provider covers this zone but is not assigned to this server”
Section titled “”A DNS provider covers this zone but is not assigned to this server””Edit the provider and select the server the domain is bound to. Reoclo verifies the token from that server when you save.
”The DNS provider token failed its check from this server”
Section titled “”The DNS provider token failed its check from this server””Open DNS providers and read the server’s result. Common causes:
- The token has a client IP restriction that does not include this server. Add the server’s public IPv4 address and its IPv6 prefix (the /64) in Cloudflare, then select Verify. Servers with IPv6 reach Cloudflare over IPv6, so the IPv4 address alone is not enough. Run
curl -s https://api.cloudflare.com/cdn-cgi/trace | grep ip=on the server to see the address Cloudflare sees. - The token lacks Zone:DNS:Edit. Edit the token in Cloudflare, then select Verify.
curlis not installed on the server. Install it and select Verify.
”Waiting for this server to run the managed Caddy image”
Section titled “”Waiting for this server to run the managed Caddy image””The server has not moved to the managed image yet. The Proxy tab shows Updating Caddy image while this happens. If it stays for more than a few minutes, check that the server can pull images from Docker Hub (run the Proxy tab’s preflight and check the registry_reachable result).
DNS status shows “mismatch” with a Cloudflare hint
Section titled “DNS status shows “mismatch” with a Cloudflare hint”The domain is proxied but no active token covers its zone. Add a provider for that zone. The status turns ok on the next DNS check.
The certificate is still from Cloudflare
Section titled “The certificate is still from Cloudflare”Cloudflare serves its own edge certificate to visitors. That is expected. DNS-01 issues the certificate between Cloudflare and your server (the origin certificate). Select Full (strict) in Cloudflare so that connection is verified.
”The zone changed since the preview”
Section titled “”The zone changed since the preview””Someone changed the zone between the preview and Apply on Cloudflare. Open Fix on Cloudflare again to see a new preview.
”A app.example.com already holds 198.51.100.1”
Section titled “”A app.example.com already holds 198.51.100.1””Reoclo found a record with a different value when it linked the domain. The link flow never replaces an existing record. Open the domain page and select Fix on Cloudflare to replace it after a preview.
”Both an A record and a CNAME are expected”
Section titled “”Both an A record and a CNAME are expected””The domain has an expected A record and an expected CNAME. A name cannot hold both. Open the Settings tab of the domain and clear one of them.
Cloudflare shows error 525 or 526
Section titled “Cloudflare shows error 525 or 526”Both errors mean that Cloudflare could not accept the TLS handshake with your server for this hostname.
- 525: the server refused the handshake. Older proxy configurations did this for a hostname with no route. Reoclo now answers every handshake, so this error clears on the next reconcile. If it stays, open the server’s Proxy tab and read the last error.
- 526: the SSL mode is Full (strict) and the server has no valid certificate for this hostname. The domain is not linked, or the certificate is not issued yet. For a hostname with no route the proxy presents a certificate from its own local CA. Strict mode rejects that certificate.
To fix 526, link the domain to an application on the server (Step 4). Reoclo issues the certificate with DNS-01 within a minute. Until then, you can set the SSL mode to Full to see the “Powered by Reoclo” page.