Skip to content
AnswerWell geo Documentation

Research · 7 min read · Answerwell

mTLS Client Certificates: RFC 9440 Headers, Rules Fields, and Origin Forwarding

How edge mTLS client certificate variables work, RFC 9440 Client-Cert headers, secure forwarding with Transform Rules and Workers, and logging.

This page summarises Cloudflare documentation on mutual TLS (mTLS) client certificates at the edge: what the Ruleset Engine and Workers expose, how RFC 9440 Client-Cert and Client-Cert-Chain headers are built, and how to forward trust to an origin without trusting unvalidated or client-injected data.

mTLS client certificate variables: what the edge exposes

Section titled “mTLS client certificate variables: what the edge exposes”

When a request includes a client certificate for mTLS authentication, Cloudflare exposes certificate details as variables in the Ruleset Engine and as properties on the Workers request.cf.tlsClientAuth object.

When a request includes a client certificate for mTLS authentication, Cloudflare exposes certificate details as variables in the Ruleset Engine and as properties on the Workers request.cf object.

— Cloudflare, Client certificate variables

Client certificate fields are available as mTLS fields in Ruleset Engine–based products such as WAF custom rules and request header modification rules. The same data is available in Workers; note that some tlsClientAuth properties use different types than their Rules language equivalents (for example certVerified is a string in Workers, not a boolean).

cf.tls_client_auth.cert_verified and cert_revoked: when to trust a certificate

Section titled “cf.tls_client_auth.cert_verified and cert_revoked: when to trust a certificate”

cf.tls_client_auth.cert_verified returns true when an mTLS client presents a valid client certificate; it also returns true when a client presents a valid certificate that was revoked (see cf.tls_client_auth.cert_revoked).

Returns true when an mTLS client presents a valid client certificate.

Also returns true when a client presents a valid certificate that was revoked (refer to cf.tls_client_auth.cert_revoked).

— Cloudflare, cf.tls_client_auth.cert_verified

cf.tls_client_auth.cert_presented is true when any certificate was presented, valid or not. Upload your client CA to Cloudflare so the edge validates certificates and populates cert_verified and cert_revoked—required for meaningful WAF rules and safe header forwarding.

Identity, validity, and fingerprint fields

Section titled “Identity, validity, and fingerprint fields”

Common rule and logging fields include subject and issuer distinguished names (default, RFC 2253, and legacy formats), serial numbers, SKI values, and validity windows (cert_not_before, cert_not_after). Fingerprints are available as cert_fingerprint_sha256 and cert_fingerprint_sha1. All of these default to empty or false when the connection does not use mTLS authentication.

RFC 9440 encoding: Client-Cert and Client-Cert-Chain header values

Section titled “RFC 9440 encoding: Client-Cert and Client-Cert-Chain header values”

RFC 9440 defines the Client-Cert and Client-Cert-Chain HTTP header fields for passing client certificate information to origin servers. Cloudflare encodes certificates so origins can consume them without custom PEM parsing.

RFC 9440 ↗︎ defines the Client-Cert and Client-Cert-Chain HTTP header fields for passing client certificate information to origin servers. You can construct these headers using request header modification rules with the following Ruleset Engine fields:

cf.tls_client_auth.cert_rfc9440 — The client leaf certificate encoded in RFC 9440 formatting (see reference). cf.tls_client_auth.cert_chain_rfc9440 — The certificate chain (excluding the leaf certificate) encoded in RFC 9440 formatting (see reference).

— Cloudflare, Forward certificate to server

Each certificate is DER-encoded, Base64-encoded, and wrapped in colons (for example :MIIDsT...Vw==:). A chain of intermediates is a comma-separated list of such values. The chain follows TLS handshake order: the certificate closest to the leaf appears first, up toward the trust anchor; the root is not included.

Field Role
cf.tls_client_auth.cert_rfc9440 Leaf certificate as RFC 9440 structured byte sequence
cf.tls_client_auth.cert_chain_rfc9440 Intermediate chain (leaf excluded), RFC 9440 list
cf.tls_client_auth.cert_rfc9440_too_large True if leaf encoding exceeded 10 KiB
cf.tls_client_auth.cert_chain_rfc9440_too_large True if chain encoding exceeded 16 KiB

When a limit is exceeded, the corresponding string field is empty; use the *_too_large boolean to tell omission due to size from “no certificate” or “no intermediates.”

Workers mirror the same RFC 9440 properties on request.cf.tlsClientAuth (certRFC9440, certRFC9440TooLarge, certChainRFC9440, certChainRFC9440TooLarge), as described in New RFC 9440 mTLS certificate fields in Workers.

Forward mTLS certificates to the origin: Transform Rules vs Workers

Section titled “Forward mTLS certificates to the origin: Transform Rules vs Workers”

Request header Transform Rules: strip, then set trusted headers

Section titled “Request header Transform Rules: strip, then set trusted headers”

Secure forwarding uses ordered request header modification rules. Remove rules must run before set rules so client-supplied Client-Cert or Client-Cert-Chain values cannot reach the origin.

You need to create the following request header modification rules. The Remove rules must be placed before the Set dynamic rules so that client-injected headers are stripped on every request before the validated values are set.

— Cloudflare, Forward certificate to server — Example Transform Rules

Set Client-Cert when the certificate is verified, not revoked, and within size limits:

cf.tls_client_auth.cert_verified
and not cf.tls_client_auth.cert_revoked
and not cf.tls_client_auth.cert_rfc9440_too_large

Header name Client-Cert, dynamic value cf.tls_client_auth.cert_rfc9440.

Set Client-Cert-Chain only when the chain is non-empty and within limits:

cf.tls_client_auth.cert_verified
and not cf.tls_client_auth.cert_revoked
and cf.tls_client_auth.cert_chain_rfc9440 ne ""
and not cf.tls_client_auth.cert_chain_rfc9440_too_large

Value: cf.tls_client_auth.cert_chain_rfc9440. The chain header may be omitted when the client sent only a leaf certificate.

If WAF custom rules already block invalid mTLS, a single set rule that overwrites those headers may suffice. If mTLS is not enforced at the WAF, add a transform that removes incoming Client-Cert and Client-Cert-Chain on all requests (true expression) before the set rules—see New mTLS certificate fields for Transform Rules.

Workers: forward RFC 9440 headers programmatically

Section titled “Workers: forward RFC 9440 headers programmatically”

In a Worker, read request.cf.tlsClientAuth and set headers on the subrequest to origin only after checks equivalent to your transform expressions—for example reject when verification fails, the cert is revoked, or the chain hit the size limit. The pattern in Workers changelog gates on certVerified, certRevoked, and certChainRFC9440TooLarge before setting Client-Cert and Client-Cert-Chain.

For visibility or custom headers (issuer DN, serial, fingerprints), Workers can expose fields listed in Client certificate variables and mTLS with Workers. Workers run after the Cloudflare WAF and Cloudflare Access in the traffic sequence documented there.

Managed Transforms and Logpush: pass certificate details without RFC 9440

Section titled “Managed Transforms and Logpush: pass certificate details without RFC 9440”

Add TLS client auth headers managed transform

Section titled “Add TLS client auth headers managed transform”

The Add TLS client auth headers managed transform adds HTTP headers to the request sent to the origin, including cf-cert-verified, cf-cert-revoked, cf-cert-presented, DN variants, serials, fingerprints, and validity dates—each mapped from the matching cf.tls_client_auth.* field.

To log mTLS certificate details such as cf-cert-subject-dn in Logpush:

  1. Enable the Add TLS client auth headers managed transform.
  2. Configure Logpush custom fields using transformed_request_fields (not request_fields).
  3. Include the RequestHeaders field in the job.

The mTLS headers are injected by Cloudflare after the client request is received, so they must be captured using transformed_request_fields rather than request_fields.

— Cloudflare, Custom fields — Logging mTLS certificate headers

HTTP request logs also expose ClientMTLSAuthCertFingerprint and ClientMTLSAuthStatus on the first request of an mTLS connection—see HTTP Requests dataset fields.

Legacy Access forwarding: proprietary headers vs RFC 9440

Section titled “Legacy Access forwarding: proprietary headers vs RFC 9440”

On accounts with Cloudflare Access, you can enable hostname-level client_certificate_forwarding via the Access certificates settings API. That adds Cf-Client-Cert-Der-Base64 and Cf-Client-Cert-Sha256 on requests within the mTLS connection (legacy flow; certificate forwarding on the first request only in the older description).

The Cf-Client-Cert-Der-Base64 and Cf-Client-Cert-Sha256 headers are a Cloudflare-proprietary mechanism. For a standardized approach, use RFC 9440 Client-Cert and Client-Cert-Chain headers.

— Cloudflare, Forward certificate to server

Cf-Client-Cert-Sha256 can feed rate limiting “Header value of” characteristics when combined with cf.tls_client_auth.cert_verified—see mTLS related features.

  • Setting RFC 9440 headers without checking cert_verified and cert_revoked — encoded cert data is present even for invalid or self-signed certs.
  • Skipping unconditional removal of incoming Client-Cert / Client-Cert-Chain when mTLS is not blocked at the WAF — clients can inject forged header values (security considerations).
  • Treating empty cert_chain_rfc9440 as an error — empty is normal when no intermediates were sent; use cert_chain_rfc9440_too_large to detect size truncation.
  • Logging with request_fields instead of transformed_request_fields after enabling managed TLS client auth headers — injected headers will not appear in raw request fields (custom fields).
  • Assuming Workers booleans match Rules fields — compare certVerified / certRevoked as strings in Workers per Client certificate variables.
  1. Confirm mTLS is enabled and your client CA is uploaded so edge validation populates cf.tls_client_auth.cert_verified and cf.tls_client_auth.cert_revoked, following Mutual TLS authentication.

  2. Send a test request with a valid client certificate and inspect whether request header transform rules or Workers set Client-Cert only for verified, non-revoked certs, per Forward certificate to server.

  3. Repeat with a request that includes spoofed Client-Cert headers and verify they are stripped before dynamic set rules run, or blocked by WAF, as described in New mTLS certificate fields for Transform Rules.

  4. If you use Logpush, confirm managed transform headers appear under transformed_request_fields in a sample job per Custom fields.

  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page is wrong or unclear, email yimasynthetic@gmail.com with the page URL and the exact statement you are asking about, and we will correct or clarify it.