SSL certificates for websites behind Cloudflare
On this page
When a website uses Cloudflare's proxy (Proxied records), visitors connect to Cloudflare, and Cloudflare connects to this server. The connection between Cloudflare and this server needs this server's certificate too. The free certificate works behind the proxy: you do not need a Cloudflare origin certificate.
How issuing works behind the proxy
A proxied domain shows Cloudflare's addresses in DNS, not this server's. AutoSSL notices that, puts a test file in the website's /.well-known/acme-challenge/ folder and checks that it comes back through Cloudflare. If it does, the certificate is issued as usual.
Recommended order
- Add the domain to Cloudflare and copy the DNS records.
- Wait until the domain shows Active on the Cloudflare page.
- Open SSL/TLS and wait for Secured next to the domain (click Check now to speed it up).
- On the Cloudflare page, click Manage, then SSL: Full (strict).
- Then click Always use HTTPS.
Which Cloudflare SSL mode to use
| Mode | Works here? |
|---|---|
| Full (strict) | Yes — recommended. Cloudflare checks this server's valid certificate. |
| Full | Works, but Cloudflare does not check the certificate. |
| Flexible | No. Cloudflare connects over HTTP, this server sends it to HTTPS, and the visitor gets "too many redirects". |
Good to know
- Keep
mail,ftpandwebmailrecords on DNS only. Mail programs connect to this server directly and use its certificate. - A wildcard certificate cannot be issued while Cloudflare serves the domain's DNS.
- A Cloudflare rule that blocks or challenges
/.well-known/acme-challenge/(for example a strict firewall rule or "I'm Under Attack" mode) stops renewals. Allow that path.
Common questions
Cloudflare shows error 526 (invalid SSL certificate).
Full (strict) is on but this server has no valid certificate for the name yet. Check SSL/TLS: when it shows Secured, the error disappears. Until then, switch Cloudflare to Full in its dashboard.
Should I install a Cloudflare origin certificate?
It is not needed. If you install one with Install your own certificate, it replaces the free certificate and is trusted only by Cloudflare, not by browsers or mail apps.
Thank you — this helps us improve the article.
Still stuck?
Ask the AI about your exact situation — it answers from this knowledge base — or contact us.
Related articles
- How to add your domain to Cloudflare and copy DNS records
Add a domain to Cloudflare from the control panel, copy its DNS records from the server, switch Cloudflare's proxy per record and change the nameservers.
- How to purge Cloudflare cache and set SSL mode from the panel
Purge Cloudflare's cache, turn on development mode, set SSL to Full (strict) and Always use HTTPS for your domain directly from the control panel.
- Website shows "too many redirects" (ERR_TOO_MANY_REDIRECTS)
Fix a redirect loop after enabling SSL or Cloudflare: Cloudflare Flexible mode, a redirect added in the panel, or the site's own address setting.
- Free SSL certificates (AutoSSL): how they work
Every website gets a free Let's Encrypt certificate automatically. Learn when it is issued, which names it covers, how renewal works and what it needs.