OpenAICloudflare Developer PlatformMar 27, 2026, 12:00 AM

Workers - New RFC 9440 mTLS certificate fields in Workers

A condensed section focused on the key takeaways first.

Original Post

Quick Digest

Summary

A condensed section focused on the key takeaways first.

openaienmodel: gpt-5-mini-2025-08-07

Workers - New RFC 9440 mTLS certificate fields in Workers

Key Points

  • RFC 9440-formatted leaf and chain fields added
  • Leaf omitted if >10 KB; chain omitted if >16 KB
  • Forward certs to origin without re-encoding

Summary

Four new fields are available on request.cf.tlsClientAuth for requests that present an mTLS client certificate. They expose the client leaf certificate and intermediate chain in RFC 9440 format so a Worker can forward them directly to your origin without custom parsing or re-encoding.

Key Points

  • New fields on request.cf.tlsClientAuth:
    • certRFC9440 (String): client leaf certificate in RFC 9440 :base64-DER: format. Empty if no client cert was presented or omitted when too large.
    • certRFC9440TooLarge (Boolean): true if the leaf certificate exceeded 10 KB and was omitted from certRFC9440.
    • certChainRFC9440 (String): intermediate certificate chain as a comma-separated list of RFC 9440 entries. Empty if no intermediates or omitted when too large.
    • certChainRFC9440TooLarge (Boolean): true if the intermediate chain exceeded 16 KB and was omitted from certChainRFC9440.
  • These fields match the same format used by the Client-Cert and Client-Cert-Chain HTTP headers, enabling direct forwarding to origin.

Practical usage

  • Validate before forwarding: ensure request.cf.tlsClientAuth exists, certVerified === true, and certRevoked === false.
  • Check size flags (certRFC9440TooLarge, certChainRFC9440TooLarge) and handle omitted fields appropriately.
  • Typical forwarding: set headers like Client-Cert = certRFC9440 and Client-Cert-Chain = certChainRFC9440 when present.

This update simplifies handling and forwarding of mTLS client certificates from Workers in a standard, interoperable format.

Full Translation

Translations

A translation section that keeps the flow of the original article.

openaijamodel: gpt-5-mini-2025-08-07

Workers — Workers における新しい RFC 9440 mTLS 証明書フィールド

新しい RFC 9440 mTLS 証明書フィールド in Workers

公開日: 2026-03-27 · カテゴリ: Workers

Workers の request.cf.tlsClientAuth に対して、相互 TLS (mTLS) クライアント証明書を含むリクエスト向けに 4 つの新しいフィールドが利用可能になりました。これらのフィールドはクライアント証明書および中間チェーンを RFC 9440 ↗ 形式でエンコードします。これは Client-Cert および Client-Cert-Chain HTTP ヘッダーで使われる標準形式と同じため、Worker はカスタムのパースやエンコード処理を行わずにそのままオリジンへ転送できます。

新しいフィールド

  • certRFC9440 (String)
    • 説明: RFC 9440 形式のクライアント(リーフ)証明書(:base64-DER:)。クライアント証明書が提示されなかった場合は空。
  • certRFC9440TooLarge (Boolean)
    • 説明: リーフ証明書が 10 KB を超え、certRFC9440 から省略された場合に true
  • certChainRFC9440 (String)
    • 説明: RFC 9440 形式の中間証明書チェーン(カンマ区切り)。中間証明書が送られなかった場合、またはチェーンが 16 KB を超えた場合は空。
  • certChainRFC9440TooLarge (Boolean)
    • 説明: 中間チェーンが 16 KB を超え、certChainRFC9440 から省略された場合に true

例: クライアント証明書ヘッダーをオリジンに転送する

次の JavaScript の例は、証明書が検証済みでチェーンが完全である場合にだけヘッダーを転送します。

export default {
  async fetch ( request ) {
    const tls = request . cf . tlsClientAuth ;
    // Only forward if cert was verified and chain is complete
    if ( ! tls || ! tls . certVerified || tls . certRevoked || tls . certChainRFC9440TooLarge ) {
      return new Response ( "Unauthorized" , { status : 401 } ) ;
    }
    const headers = new Headers ( request . headers ) ;
    headers . set ( "Client-Cert" , tls . certRFC9440 ) ;
    headers . set ( "Client-Cert-Chain" , tls . certChainRFC9440 ) ;
    return fetch ( new Request ( request , { headers } )) ;
  },
};

詳細はドキュメント「Client certificate variables」および「Mutual TLS authentication」を参照してください。