Skip to content

Cloudflare ​

You can put your sites behind Cloudflare's orange cloud (proxy) safely. The Cloudflare section is at the bottom of the SSL certificates page.

  1. In Cloudflare DNS, add an A record for the domain (and www) pointing to your server's IP, with the orange cloud on (Proxied).
  2. In the panel, open SSL certificates → Cloudflare and press Turn on Cloudflare mode.
  3. Get a certificate for the site as usual (Let's Encrypt keeps working behind the orange cloud), or use a Cloudflare Origin certificate (below).
  4. In Cloudflare, SSL/TLS → Overview, set the encryption mode to Full (strict).

Use Full (strict)

With Flexible, Cloudflare talks to your server over plain http. If the site also forces https you get an endless redirect ("too many redirects"). With Full (strict), Cloudflare connects over https and checks your certificate.

What Cloudflare mode does ​

  • Real visitor IPs: the server reads CF-Connecting-IP, trusted only from Cloudflare's own address ranges. Logs, PHP, the traffic center and the sign-in lockout all see the real visitor, not Cloudflare.
  • The list of Cloudflare ranges is built in. Update the ranges from cloudflare.com refreshes it.

Only through Cloudflare ​

In the site table, Only through Cloudflare drops every visit that does not come from Cloudflare. Then nobody can use your server's IP to get around Cloudflare's firewall and DDoS protection. Turn it on only for sites whose DNS is proxied by Cloudflare. Allow direct turns it off.

Origin certificate ​

Instead of Let's Encrypt you can use a Cloudflare Origin certificate (valid up to 15 years, trusted only by Cloudflare):

  1. In Cloudflare: SSL/TLS → Origin Server → Create certificate. Keep the default (RSA, the domain and *.domain).
  2. Copy the certificate and the private key.
  3. In the panel, open the site's page, Paste a certificate, paste both, and save.
  4. Keep Cloudflare on Full (strict).

Only use an Origin certificate when the orange cloud is on: visitors who reach the server directly would see a certificate warning.

The DNS badge ​

Next to each domain the panel shows a DNS badge. Behind Cloudflare it reads DNS ok (Cloudflare) when the check reaches your server through Cloudflare. If it says the domain is proxied but the check could not reach this server, the origin IP in Cloudflare is wrong.

Troubleshooting ​

SymptomFix
Too many redirectsSet Cloudflare SSL to Full (strict), not Flexible
Error 526 (invalid SSL certificate)The site has no valid certificate yet: get one, or paste an Origin certificate
Error 521 / 522Cloudflare cannot reach the server: check the A record IP and that ports 80/443 are open
Let's Encrypt fails behind CloudflareMake sure no Cloudflare rule blocks /.well-known/acme-challenge/, or use an Origin certificate
Logs show Cloudflare IPsTurn on Cloudflare mode

SetServer Panel documentation