All Deployment guides Deployment

Setting Up an Origin Certificate with Cloudflare

When you use Cloudflare as a CDN/proxy, your visitors connect to Cloudflare’s edge servers. But what about the connection between Cloudflare and your origin server? Without a certificate on your origin, that connection may be unencrypted — defeating the purpose of HTTPS.

Cloudflare SSL modes explained

ModeVisitor → CloudflareCloudflare → OriginSecurity
OffHTTPHTTP❌ No encryption
FlexibleHTTPS ✅HTTP ❌⚠️ False sense of security
FullHTTPS ✅HTTPS (unverified)⚠️ Encrypted but no cert validation
Full (Strict)HTTPS ✅HTTPS (verified) ✅✅ Recommended

“Flexible” is dangerous. Your visitors see a padlock, but the Cloudflare→origin connection is plain HTTP. Anyone on that network path can read the traffic. Always use Full (Strict).

Setting up Full (Strict) with a Let’s Encrypt certificate

The best approach: install a real, publicly-trusted certificate on your origin and enable Full (Strict).

Step 1: Get a Let’s Encrypt certificate

Use GetHTTPS to get a free certificate for your domain. You need to temporarily disable Cloudflare proxy (gray cloud in DNS settings) for the HTTP-01 challenge to reach your origin, or use DNS-01 which works regardless.

DNS-01 method (no proxy change needed):

  1. In GetHTTPS, choose DNS-01 challenge
  2. Add the _acme-challenge TXT record in Cloudflare DNS
  3. Verify and download the certificate

HTTP-01 method:

  1. In Cloudflare DNS, click the orange cloud → gray cloud (DNS only) for your domain
  2. Complete the HTTP-01 challenge in GetHTTPS
  3. After getting the certificate, re-enable the orange cloud (proxied)

Step 2: Install on your origin server

Install the certificate on Nginx or Apache as normal.

Step 3: Enable Full (Strict) in Cloudflare

  1. Go to Cloudflare dashboard → your domain
  2. SSL/TLSOverview
  3. Select Full (Strict)

Cloudflare will now verify that your origin has a valid, trusted certificate before connecting.

Alternative: Cloudflare Origin CA certificate

Cloudflare offers its own Origin CA certificates — free certificates that are trusted only by Cloudflare, not by browsers directly.

How to get one

  1. Cloudflare dashboard → SSL/TLSOrigin Server
  2. Click Create Certificate
  3. Choose key type (RSA or ECDSA) and validity (up to 15 years)
  4. Download the certificate and private key
  5. Install on your origin server

Pros and cons vs Let’s Encrypt

Cloudflare Origin CALet’s Encrypt (via GetHTTPS)
Trusted byCloudflare onlyAll browsers (publicly trusted)
ValidityUp to 15 years90 days
Auto-renewal neededNo (long validity)Yes (every 60-90 days)
Works without Cloudflare
Direct browser access❌ (shows error)
CostFreeFree

Use Cloudflare Origin CA if your origin is always behind Cloudflare and you want zero renewal management.

Use Let’s Encrypt if you might bypass Cloudflare (maintenance, migration), need direct access to your origin, or want a certificate that works everywhere.

Verifying Full (Strict) is working

After setup, test that the connection is fully encrypted:

  1. Cloudflare dashboard → SSL/TLSOverview should show “Full (Strict)”
  2. Visit your site → padlock should show Cloudflare’s certificate to visitors
  3. Check origin directly (bypassing Cloudflare):
    curl -I --resolve yourdomain.com:443:YOUR_ORIGIN_IP https://yourdomain.com
    This should return a valid HTTPS response with your Let’s Encrypt (or Origin CA) certificate.

Frequently asked questions

Why not just use Flexible mode?

Flexible mode encrypts the visitor→Cloudflare connection but sends traffic from Cloudflare to your origin in plain HTTP. This means:

  • Your ISP, hosting provider, or anyone on the network between Cloudflare’s edge and your server can read all traffic
  • Your visitors see a padlock and think they’re secure, but the backend connection is not
  • This is especially dangerous for login pages, payment forms, or any sensitive data

Does my origin certificate need to match my domain exactly?

For Full (Strict) mode, yes — the origin certificate must be valid for the domain Cloudflare is connecting to. A Let’s Encrypt certificate for example.com will work. A self-signed certificate or a certificate for a different domain will not.

Can I use a wildcard origin certificate?

Yes. A wildcard certificate for *.example.com on your origin works with Full (Strict) for any subdomain proxied through Cloudflare.

What happens if my origin certificate expires?

Cloudflare’s Full (Strict) mode checks certificate validity. If your origin cert expires, Cloudflare can’t establish a secure connection and your site shows a 526 error (Invalid SSL Certificate). Set up expiry monitoring to prevent this.

Related articles

Compare 2026-05-07
Let's Encrypt vs Cloudflare SSL: Which Should You Use?
Let's Encrypt gives you a certificate you own. Cloudflare manages SSL as part of their CDN proxy. Compare the two approaches for privacy, control, and use cases.
Deployment 2026-05-08
How to Install an SSL Certificate on Nginx
Step-by-step guide to installing an SSL certificate on Nginx. Covers file upload, full server block config, TLS best practices, HTTP/2, HSTS, redirect setup, testing, and troubleshooting 6 common errors.
Getting Started 2026-05-08
How to Get a Free SSL Certificate (Step-by-Step Guide)
Get a free SSL certificate from Let's Encrypt in 5 minutes — no software to install, no account to create. Complete guide covering 4 methods, both challenge types, installation on 6 platforms, and troubleshooting.
Get a free SSL certificate in your browser
No installation, no account. Your private key never leaves your device.
Get your certificate