Skip to content

Origin certificates: end-to-end TLS from Cloudflare to your servers

Cloudflare Origin CA issues free certs that the Cloudflare edge will trust but no browser will. Pair them with Authenticated Origin Pulls and your origin only answers when Cloudflare is the client. Here is how to issue, install, and lock down.

Once you set the zone to Full (Strict), the origin needs a cert that Cloudflare trusts. The free, public option (Let’s Encrypt) works but adds renewal plumbing every 90 days and only matters if a non-Cloudflare client ever talks to the origin — which it shouldn’t. Cloudflare Origin CA is the purpose-built alternative: a private CA whose root is trusted by the Cloudflare edge and nothing else. This article walks through issuing the cert in the dashboard, installing on Nginx/Apache/HAProxy, then locking the origin to Authenticated Origin Pulls so only Cloudflare can complete a handshake.

How to verify

Check what the origin is serving now and whether AOP is on:

# Cert currently on the origin (bypass Cloudflare, talk to the IP directly)
openssl s_client -connect <origin-ip>:443 -servername example.com </dev/null 2>&1 \
  | openssl x509 -noout -subject -issuer -dates

# Is Authenticated Origin Pulls enabled on the zone?
curl -X GET "https://api.cloudflare.com/client/v4/zones/<zone-id>/settings/tls_client_auth" \
  -H "Authorization: Bearer <token>"

# Probe the origin directly without a client cert — should be rejected once AOP is enforced at the origin
curl -kv --resolve example.com:443:<origin-ip> https://example.com/

# Probe through Cloudflare — should succeed
curl -I https://example.com/

If the first command returns a cert issued by CN=Cloudflare Origin CA, O="Cloudflare, Inc.", the Origin CA cert is already installed. If it returns Let’s Encrypt or a self-signed cert, you have work to do.

What’s happening

Cloudflare Origin CA is a private certificate authority. Its root is in the trust store that Cloudflare’s edge uses when it does TLS toward your origin — but not in any browser trust store. That means a cert issued by Origin CA is perfectly trusted in the only path that should ever exist (edge → origin) and rejected anywhere else, which is exactly what you want for a backend that should never be reached by random clients.

Two things make it strictly better than a public cert for the origin role: validity is up to 15 years (no scheduled renewal), and issuance is gated by your Cloudflare API token, so you can automate creation from a script without solving an HTTP-01 or DNS-01 challenge.

Authenticated Origin Pulls (AOP) is the second half. With AOP enabled at the edge AND enforced at the origin, every TLS handshake from Cloudflare to your origin includes a client certificate signed by Cloudflare’s CA. The origin verifies that client cert in its TLS config and rejects any handshake that doesn’t present one. The result: even if an attacker discovers your origin IP and reaches port 443, the handshake fails — they can’t forge Cloudflare’s client cert.

Cloudflare edgeclient cert(AOP)presents client certpresents Origin CA certOriginverifies client cert,serves Origin CA certAttackerno client cert — rejectedMutual TLS between Cloudflare and originEach side proves identity to the other.
Origin CA secures the origin-to-edge direction; AOP authenticates the edge-to-origin direction.

The pair gives you authenticated TLS in both directions plus origin lockdown without standing up your own PKI or paying for a commercial cert.

The procedure

  1. Issue the Origin CA cert in the dashboard. Go to SSL/TLS → Origin Server → Create Certificate. Pick RSA 2048 or ECDSA P-256 (ECDSA is smaller and faster; pick it unless an old origin doesn’t support it). List the hostnames the cert should cover — at minimum example.com and *.example.com. Choose validity (default 15 years is fine for the Origin CA cert; you can rotate sooner manually). Cloudflare returns two PEM blobs in the browser: the certificate and the private key. The private key is shown ONCE and only here.

  2. Save the key and cert to the origin securely. On the origin server, write the files into the TLS directory with restrictive permissions:

    sudo install -m 0600 -o root -g root /dev/stdin /etc/ssl/private/origin.key <<< "<paste key>"
    sudo install -m 0644 -o root -g root /dev/stdin /etc/ssl/certs/origin.crt <<< "<paste cert>"
  3. Wire it into the web server. Nginx:

    server {
      listen 443 ssl http2;
      server_name example.com;
      ssl_certificate     /etc/ssl/certs/origin.crt;
      ssl_certificate_key /etc/ssl/private/origin.key;
      # ... rest of server block
    }

    Apache (httpd-ssl.conf or vhost):

    SSLEngine on
    SSLCertificateFile      /etc/ssl/certs/origin.crt
    SSLCertificateKeyFile   /etc/ssl/private/origin.key

    HAProxy combines key and cert in one PEM:

    cat /etc/ssl/certs/origin.crt /etc/ssl/private/origin.key \
      > /etc/ssl/private/origin-combined.pem
    chmod 0600 /etc/ssl/private/origin-combined.pem
    # in frontend: bind :443 ssl crt /etc/ssl/private/origin-combined.pem

    Reload (nginx -t && nginx -s reload, apachectl configtest && apachectl graceful, haproxy -c -f ... then reload). Re-run the openssl s_client probe and confirm the issuer now says Cloudflare Origin CA.

  4. Enable Authenticated Origin Pulls at the zone. Under SSL/TLS → Origin Server → Authenticated Origin Pulls, turn the toggle on. This makes Cloudflare present its client cert on origin pulls — but the origin will only enforce it once you configure the web server to require it.

  5. Enforce AOP at the origin. Download Cloudflare’s AOP root cert (https://developers.cloudflare.com/ssl/static/authenticated_origin_pull_ca.pem — verify the current URL in the Cloudflare docs before scripting) and reference it in the web server. Nginx:

    ssl_client_certificate /etc/ssl/certs/cloudflare-aop-ca.pem;
    ssl_verify_client on;

    Apache:

    SSLVerifyClient require
    SSLVerifyDepth 1
    SSLCACertificateFile /etc/ssl/certs/cloudflare-aop-ca.pem

    Reload. From outside Cloudflare, the curl -kv --resolve probe should now fail with a TLS error (no client cert). Through Cloudflare, the site continues to serve normally.

  6. Restrict the origin firewall to Cloudflare IPs. Belt and braces. Allow 443 only from the IPv4 + IPv6 ranges published at https://www.cloudflare.com/ips/ and drop everything else. This blocks even scanners that would otherwise burn cycles on the AOP rejection.

  7. Plan rotation. Origin CA certs default to 15 years, but rotate the private key on a schedule that matches your other secrets — annually is a common cadence. Reissue from the dashboard, swap the files, reload, done.

Common pitfalls

  • Saving the Origin CA private key into a Git repo or a shared password manager that wasn’t designed to hold key material — the key is shown once for a reason.
  • Enabling AOP in the dashboard but forgetting to configure ssl_verify_client at the origin, so the origin still accepts any client (including no client cert) — AOP gives you nothing until both halves are on.
  • Listing only example.com in the SAN list and forgetting *.example.com, so subdomain requests fail with HTTP 526 once Full (Strict) is enforced.
  • Pulling the AOP CA PEM from a stale URL — Cloudflare has rotated the path before; bookmark the current location from the docs, not from a copy-pasted snippet.
  • Forgetting to restrict the origin firewall AFTER enabling AOP, so attackers still find the origin IP and exhaust your TLS handshake CPU even if they can’t get past the cert check.

In the engagements we run, Origin CA + AOP is the default after the Flexible to Full (Strict) migration — it removes a renewal job and shrinks the origin’s attack surface to one allowed peer. Stack Harbor operates the cert lifecycle, firewall rules, and edge config together under managed operations so the three stay aligned through infrastructure changes.