Skip to content
Skip to Content

Domains on Cloudflare

Connect a Cloudflare zone with a token limited to it, and OpenPanel writes, checks and removes your own domains' DNS records there, behind Cloudflare's certificate.

When your domain's DNS is on Cloudflare, OpenPanel can write its records for you. An organization admin connects the zone once, with a Cloudflare API token that can edit DNS in that one zone and nothing else. From then on, every own domain added in the zone:

  • gets its TXT record at _openpanel. and the domain, which proves the domain is yours, and is verified by itself: OpenPanel looks for the record every minute;
  • gets a proxied CNAME to edge.openpanel.sh, so visitors see Cloudflare's certificate and Cloudflare carries their requests to OpenPanel's edge;
  • loses both records when you remove the domain, or when its service or project is deleted.

OpenPanel never touches a record it did not write, and never replaces one that is already there.

1. Create the token

  1. In Cloudflare, open My Profile, then API Tokens, then Create Token, and choose Create Custom Token.
  2. Permissions: Zone · Zone · Read, and Zone · DNS · Edit. Optionally Zone · Zone Settings · Read, so OpenPanel can tell you the zone's SSL/TLS mode.
  3. Zone Resources: Include · Specific zone · your domain. One zone only: OpenPanel refuses a token that reaches more than one.
  4. Create the token and copy it. Cloudflare shows it once.

2. Set the zone's SSL/TLS mode to Full

In Cloudflare, open the zone, then SSL/TLS, and set the encryption mode to Full. Cloudflare then reaches OpenPanel's edge over HTTPS and accepts the edge's own certificate.

ModeWith OpenPanel
FullWorks.
Full (strict)Works only for domains with an uploaded certificate that Cloudflare trusts, such as a Cloudflare Origin CA certificate. Otherwise Cloudflare refuses the edge's certificate (error 526).
Flexible or OffDoes not work: Cloudflare would talk plain HTTP to the edge, which only redirects to HTTPS.

OpenPanel shows the mode Cloudflare reported beside the zone when the token may read it.

3. Connect the zone

On the Domains page, under Cloudflare zones, choose Connect zone and paste the token.

OpenPanel asks Cloudflare whether the token is active, which zones it reaches and whether it can read their DNS, then keeps the token sealed. Connecting a zone needs the admin role in the organization.

4. Add domains

Add your own domain as usual. When it is in a connected zone (app.example.com in example.com, or example.com itself), the answer already names the zone in dnsZoneId, and the domain is verified within a few minutes without a Check DNS.

If the name already has a record in Cloudflare (an A record at the root, an older CNAME), OpenPanel writes the TXT record only and says so in dnsProblem and on the domain's row. Point the existing record at edge.openpanel.sh yourself, proxied, or delete it in Cloudflare and add the domain again.

Replace the token or disconnect

  • Replace the token, after you rolled it in Cloudflare: the console's Replace token in the zone's menu, printf %s "$CLOUDFLARE_TOKEN" | openpanel dns token example.com, or PUT /api/v1/dns-zones/{zoneId}/token. The new token must reach the same zone.
  • Disconnect forgets the zone and its token: the console's Disconnect, openpanel dns remove example.com, or DELETE /api/v1/dns-zones/{zoneId}. It is refused while a domain has records OpenPanel wrote there; remove those domains first.

What can go wrong

MessageWhat it means
"This token reaches 2 zones (…). Create one limited to a single zone."The token's Zone Resources include more than one zone.
"This token reaches no zone."The token lacks Zone · Zone · Read.
"… is pending in Cloudflare: its nameservers do not point at Cloudflare yet."Finish adding the zone in Cloudflare first.
"Cloudflare refused to read the DNS records of …"The token lacks Zone · DNS · Edit for that zone.
"Cloudflare says this token is disabled."Create a new token.
"… is already connected. Replace its token there instead."The zone is connected; use Replace token.