skip to content

How do Cloudflare's Authenticated Origin Pulls prove an origin request came through Cloudflare, and how do you roll them out without an outage?

level: middleimportance: should knowfreq 50%

answer

  1. the origin asks for a certificate
  2. mutual TLS on the edge-to-origin hop
  3. global, zone-level, per-hostname
  4. optional, then required

basics

~20 s

Authenticated Origin Pulls add mutual TLS to the edge-to-origin connection: Cloudflare presents a client certificate and the origin refuses any HTTPS handshake without a valid one. Install the CA, verify optionally, enable AOP, confirm, then require.

solid answer

~50 s

Authenticated Origin Pulls (AOP) make Cloudflare present a client certificate when it connects to the origin, and the origin verifies it against a CA it trusts, so a direct HTTPS request from anywhere else fails the handshake. It needs the Full or Full (strict) encryption mode; under Off or Flexible there is no TLS to the origin and AOP does nothing. There are three independent levels: **global**, with Cloudflare's shared certificate, and **zone-level** or **per-hostname**, with a leaf certificate you upload; per-hostname wins over zone-level, which wins over global. Roll out in order: install the CA on the origin, set client verification to optional and log it, turn AOP on, confirm every request presents the certificate, then make verification required and check that `curl` straight to the origin IP now fails. Watch expiry: Cloudflare keeps presenting an expired certificate until you replace it.

code

bash · 9 lines
bash
# Through Cloudflare: should succeed
curl -sS -o /dev/null -w '%{http_code}\n' https://app.example.com/

# Straight to the origin IP, skipping Cloudflare: should fail the TLS handshake
# once client-certificate verification is required.
# --insecure only skips checking the origin's own certificate, so a failure
# here is the client-certificate check and not an untrusted server certificate.
curl -sS -o /dev/null -w '%{http_code}\n' --insecure \
  --resolve app.example.com:443:203.0.113.10 https://app.example.com/

go deeper

for a junior

Recall that AOP is mutual TLS between Cloudflare and the origin, and that it only works with the Full or Full (strict) encryption mode.

for a middle

Explain the global, zone-level and per-hostname levels, which certificate each uses, their precedence, and the optional-then-required rollout with a direct curl test.

for a senior

Show how you would catch unmapped paths in the optional phase, rotate certificates by overlap, and why expiry silently becomes an outage.

for a principal

Weigh where AOP is worth its per-server configuration across a fleet, against a Tunnel for some origins, and keep the IP allowlist underneath either way.

## What AOP adds to the connection A normal origin pull is a standard TLS handshake: Cloudflare checks the origin's certificate (under **Full (strict)**), but the origin learns nothing about who is calling. Anyone with the origin's IP gets the same handshake Cloudflare gets. **Authenticated Origin Pulls** turn that hop into **mutual TLS**. The origin asks for a client certificate during the handshake, Cloudflare presents one, and the origin checks it against a CA certificate it has been told to trust. A client that cannot present a valid certificate never gets an HTTPS response. The block also covers requests that arrive through a DNS-only record, because the check runs at the origin, not at the edge. Two prerequisites matter: - The zone's SSL/TLS encryption mode must be **Full** or **Full (strict)** (or stricter). Under **Off** or **Flexible** Cloudflare talks plain HTTP to the origin, so there is no handshake to authenticate. - AOP is available on every plan, Free through Enterprise. ## The three configuration levels | Level | Client certificate | Applies to | What it proves | |---|---|---|---| | Global | Cloudflare-provided, shared by all accounts | All proxied hostnames on the zone | The request came from Cloudflare's network | | Zone-level | A leaf certificate you upload | All proxied hostnames on the zone | The request came from your account's configuration | | Per-hostname | A leaf certificate you upload | The hostnames you associate with it | The same, with a separate certificate per hostname | The levels are independent toggles: enabling or disabling one does not change the others. For a given hostname, a per-hostname certificate takes precedence over a zone-level one, which takes precedence over global. Global AOP is switched with the zone setting `tls_client_auth`; zone-level and per-hostname AOP have their own API endpoints under `origin_tls_client_auth`. For global AOP the origin trusts Cloudflare's origin-pull CA file, which is **not** the Origin CA certificate used for the origin's own server certificate. For the other two, the origin trusts the CA that issued the certificate you uploaded, and the upload must be a leaf certificate, not a root CA. ## A rollout that does not drop traffic 1. Confirm the encryption mode is Full or Full (strict) for every hostname involved. 2. Install the CA certificate on the origin web server, and configure client-certificate verification as **optional**, with the verification result in the access log. 3. Turn on the AOP level you chose (and, for per-hostname, associate the hostnames with the certificate). 4. Watch the log until every request from Cloudflare shows a verified client certificate. Anything that does not is a path you had not mapped: a DNS-only record, a health checker, a partner calling the origin directly. 5. Switch verification to **required**. 6. Test from outside Cloudflare: a request sent straight to the origin's IP must now fail the TLS handshake. Skipping step 2 and going straight to required is how teams take their own site down: if the AOP toggle is not yet live, or one hostname was missed, every request fails at once. ## Operating it - **Expiry is yours to manage.** Cloudflare does not delete or renew an uploaded client certificate when it expires, and an origin that requires a valid certificate then drops Cloudflare's requests. Set up the expiration notifications, which fire 30 and 14 days ahead. - **Rotate by overlap.** Upload the new certificate, confirm it is active, then delete the old one; while both exist, the most recently deployed one is presented. - **Not for Tunnel hostnames.** A hostname served through Cloudflare Tunnel has no inbound listener, so AOP has no effect there; the tunnel's connector credentials already authenticate the link. - **Not a replacement for the IP allowlist.** AOP rejects unauthenticated HTTPS requests, but the origin still completes TCP with anyone and still presents its own server certificate before asking for the client's. Keep both controls. - **Scale.** Each origin web server needs the CA and the verification setting, which is real configuration work across a large fleet. - **Custom hostnames.** Global and zone-level AOP also apply to custom hostnames on a Cloudflare for SaaS zone; when those need a different certificate, use per-hostname AOP. - **Compliance.** Using your own certificate rather than the global one is also required for FIPS compliance. - **Logging.** Keep the verification result in the origin's access log after enforcement, so a sudden run of failed handshakes points straight at an expired or replaced certificate.

  • Does Full (strict) already do what Authenticated Origin Pulls do?
    No; they authenticate opposite directions. Full (strict) makes Cloudflare verify the origin's server certificate, so Cloudflare knows it reached the real origin. AOP makes the origin verify Cloudflare's client certificate, so the origin knows the caller is Cloudflare. A zone wants both, and AOP requires Full or stricter to work at all.
  • How do you replace a zone-level AOP certificate without downtime?
    Make the origin trust the CA of the new certificate first, upload the new certificate, check through the API that it is active, then delete the old one. While both are present the most recently deployed one is presented. Because Cloudflare never removes an expired certificate by itself, schedule this ahead of the 30- and 14-day expiration alerts.

  • Authenticated Origin Pulls work under Flexible as long as the origin listens on 443.
  • Cloudflare renews an uploaded AOP client certificate automatically before it expires.
  • The global AOP certificate is the same thing as an Origin CA certificate.
  • Turn on required client verification first, then enable AOP in the dashboard.
  • With AOP on, the origin's IP allowlist can be removed.