Cloudflare
Connect a site's domain to Cloudflare and manage its DNS records and zone settings from the panel.
What the panel does
The panel talks to Cloudflare's API with a credential you give it. For a connected domain it can:
- create the zone in Cloudflare, or link one that is already there;
- add the DNS records that point the site at this server;
- edit DNS records, and switch Cloudflare's proxy on or off for each;
- change the zone's SSL/TLS, firewall, speed, caching, network and Scrape Shield settings;
- purge Cloudflare's cache, and switch Under attack mode on and off.
It manages what is in Cloudflare; it does not replace the Cloudflare account. You still need one, and the domain's nameservers are changed at the registrar, not here.
Separately, and for every site whether or not it was connected in the panel, the server shows the real visitor's address for requests that arrive through Cloudflare. See Visitor addresses.
Whose Cloudflare account
One switch on Hosting → Cloudflare decides this for the whole server: Customers use their own Cloudflare accounts.
| Switch | Credential used to connect | Who manages |
|---|---|---|
| Off (default) | The administrator's, under Admin Cloudflare credentials. Every customer's zone lands in your Cloudflare account. | Administrators only. Customers have no Cloudflare page; a connected site of theirs shows "Managed by your provider". |
| On | Each account's own. | The customer, on their Cloudflare page and on each site's Cloudflare tab. An administrator can do the same for any account. |
There is no fallback from one to the other: with the switch on, an account without a credential of its own cannot connect anything.
Zones that are already connected stay in the Cloudflare account that holds them when you change the switch. A zone keeps the credential it was connected with.
The credential
Either of:
- An API token (recommended). It needs these permissions: Zone: Read, Zone Settings: Edit, DNS: Edit, Firewall Services: Edit, Cache Purge: Purge, SSL and Certificates: Edit. To let the panel create zones, also Account: Read and Zone: Edit. Without those two the token can only link zones that already exist in Cloudflare.
- The Global API key with the Cloudflare account's email.
The panel checks the credential with Cloudflare when you save it. After that it is stored encrypted and never shown again: the page says only "Connected as …". Replace takes a new one. Remove deletes it from the panel; zones connected with it can no longer be managed until a new one is added, and nothing changes in Cloudflare.
Server addresses
Server public IPv4 / IPv6 for DNS records on the same page are the addresses the panel writes into new A and AAAA records. Left empty, the panel uses the public addresses it detects on the server. A server behind NAT has none to detect, so fill them in; otherwise connecting a site adds no records and says so.
Connecting a site
The list of sites is on Hosting → Cloudflare after you pick an account, and on the customer's Cloudflare page. Connect on a site's row:
- Finds the zone for the site's registrable domain:
example.comforshop.example.com. If Cloudflare has no such zone, the panel creates it. - Adds A and AAAA records for the site's domain, and for
www.when the site has the www alias, for every site of the account under that zone. Records that already exist are left alone. - Shows the two nameservers Cloudflare assigned.
Then set those nameservers at the domain's registrar. Until Cloudflare sees them, the zone is Pending; Check now asks Cloudflare again.
Two things to know:
- New records are DNS only. The panel adds them with the proxy off, so traffic still comes straight to the server. Switch the proxy on per record under Manage → DNS when the zone is active and you want Cloudflare in front of the site.
- A zone is one registrable domain and belongs to one account. Every site of that account under the domain shares the zone and its settings. A domain that another account on the server already uses cannot be connected: "Not available: this domain is used by another account".
The Status column
| Shown | Meaning |
|---|---|
| Not connected | No zone is linked. Connect is offered. |
| Pending, Initializing | Cloudflare has the zone and is waiting for the nameservers. |
| Active | Cloudflare answers DNS for the domain. |
| Moved, Deleted, Deactivated | Cloudflare no longer serves the zone: the nameservers were changed away, or the zone was removed there. |
| Credentials missing | The credential the zone was connected with was removed. Add one again. |
| Managed by your provider | Shown to a customer whose zone is in the administrator's Cloudflare account. |
Add this site's records adds the site's A and AAAA records again when they are missing, for example for a site created after the zone was connected.
Managing a zone
Manage → opens the zone with these tabs. Everything except DNS applies to every site under the zone.
| Tab | What is there |
|---|---|
| DNS | Records of type A, AAAA, CNAME, MX, TXT, SRV, CAA, NS and LOC, with TTL. The proxy switch exists for A, AAAA and CNAME. |
| SSL/TLS | Encryption mode, Always Use HTTPS, minimum TLS version, TLS 1.3, Automatic HTTPS Rewrites, Opportunistic Encryption, HSTS. |
| Firewall | Security level, Browser Integrity Check, Challenge passage, and IP access rules: Block, Challenge, JS Challenge, Managed Challenge or Allow for an IPv4 or IPv6 address, an IP range, an AS number or a country. |
| Speed | Brotli, Early Hints, Rocket Loader, HTTP version to origin. |
| Caching | Caching level, Browser cache TTL, Development mode, Always Online, and cache purge: everything, or up to 30 URLs at a time. |
| Network | HTTP/3, WebSockets, IPv6 compatibility, IP geolocation, Pseudo IPv4, Onion routing. |
| Scrape Shield | Email address obfuscation, Server-side excludes, Hotlink protection. |
Each change is sent to Cloudflare when you save it, and the page shows what Cloudflare answers. A setting that the zone's Cloudflare plan does not include is refused by Cloudflare with its own message.
The Under attack switch in the sites list sets the security level to "I'm Under Attack" for the whole zone and back.
Encryption mode and the site's certificate
With the proxy on, Cloudflare connects to this server on the visitor's behalf, and the encryption mode decides how:
- Full (strict) needs a certificate on the site that Cloudflare trusts. A Let's Encrypt certificate issued in the panel is one.
- Full also accepts the self-signed certificate a new site starts with.
- Flexible connects over plain HTTP. A site that redirects HTTP to HTTPS then redirects for ever. Avoid it.
Disconnecting
Disconnect removes the link for every site under the zone. The zone and its DNS records stay in Cloudflare, so the domain keeps working. Only the separate Also delete the zone from Cloudflare option deletes the zone there, which stops DNS for the domain.
Deleting a site or an account in the panel deletes nothing in Cloudflare. The link is dropped once the account has no site left under the domain.
Visitor addresses
When Cloudflare's proxy is on, every connection to the server comes from Cloudflare, with the visitor's address in the CF-Connecting-IP header. The web server takes the visitor's address from that header, so for a site behind Cloudflare:
- the site's access and error logs show the visitor;
- PHP's
REMOTE_ADDRand address rules in.htaccesssee the visitor.
This is always on and has no switch. The header is believed only when the connection really comes from one of Cloudflare's published address ranges, which ship with alxpanel and are refreshed with each release. From any other address the header is ignored: anyone can send it, and the server itself is reachable without Cloudflare.
What still shows Cloudflare's addresses:
- Top source IPs on the dashboard, which counts connections to the server.
- The server's own firewall and fail2ban. Banning a visitor's address there does nothing while their requests arrive through Cloudflare. Block them in Cloudflare instead: an IP access rule on the zone's Firewall tab.
The panel itself (port 8443) trusts no such header; do not put it behind Cloudflare's proxy.
A server with its own real_ip_header
The ranges are in /etc/nginx/conf.d/alxpanel-cloudflare-realip.conf. Updates replace this file, so put additions of your own in a separate file in the same folder.
nginx allows only one real_ip_header there. If your own configuration already sets one, alxpanel empties its file on install or update, leaves yours alone and says so in the journal (journalctl -t alxpanel). To come back to alxpanel's: remove your directive, delete the file and run dnf reinstall alxpanel-webstack.