RFC 9440: Client-Cert HTTP Header Field
- B. Campbell,
- M. Bishop
Abstract
This document describes HTTP extension header fields that allow a TLS terminating reverse proxy (TTRP) to convey the client certificate information of a mutually authenticated TLS connection to the origin server in a common and predictable manner.¶
Status of This Memo
This document is not an Internet Standards Track specification; it is published for informational purposes.¶
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Not all documents approved by the IESG are candidates for any level of Internet Standard; see Section 2 of RFC 7841.¶
Information about the current status of this document, any
errata, and how to provide feedback on it may be obtained at
https://
Copyright Notice
Copyright (c) 2023 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents
(https://
1. Introduction
A fairly common deployment pattern for HTTPS applications is to have the origin HTTP application servers sit behind a reverse proxy that terminates TLS connections from clients. The proxy is accessible to the Internet and dispatches client requests to the appropriate origin server within a private or protected network. The origin servers are not directly accessible by clients and are only reachable through the reverse proxy. The backend details of this type of deployment are typically opaque to clients who make requests to the proxy server and see responses as though they originated from the proxy server itself. Although HTTPS is also usually employed between the proxy and the origin server, the TLS connection that the client establishes for HTTPS is only between itself and the reverse proxy server.¶
The deployment pattern is found in a number of varieties such as n-tier architectures, content delivery networks, application load-balancing services, and ingress controllers.¶
Although not exceedingly prevalent, TLS client certificate
authentication is sometimes employed, and in such cases the origin
server often requires information about the client certificate for its
application logic. Such logic might include access control decisions,
audit logging, and binding issued tokens or cookies to a certificate, including
the respective validation of such bindings. The specific details
needed from the certificate also vary with the application
requirements. In order for these types of application deployments to
work in practice, the reverse proxy needs to convey information about
the client certificate to the origin application server. At the time of
writing, a common way this information is conveyed is by using
non-standard fields to carry the certificate (in some encoding) or
individual parts thereof in the HTTP request that is dispatched to the
origin server. This solution works, but interoperabilit
The scope of this document is to describe existing practice while
codifying specific details sufficient to facilitate improved and
lower-touch interoperabilit
1.1. Requirements Notation and Conventions
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.¶
1.2. Terminology and Applicability
This document uses the following terminology from Section 3 of [STRUCTURED
Phrases like "TLS client certificate authentication" or "mutually
authenticated TLS" are used throughout this document to refer to the
process whereby, in addition to the normal TLS server authentication
with a certificate, a client presents its X.509 certificate [RFC5280] and proves possession of the corresponding private
key to a server when negotiating a TLS connection or the resumption of
such a connection.
In contemporary versions of TLS [TLS] [TLS1.2], mutual authentication requires the client to send
the Certificate and Certificate
HTTP/2 restricts TLS 1.2 renegotiation (Section 9.2.1 of [HTTP/2]) and prohibits TLS 1.3 post-handshake authentication (Section 9.2.3 of [HTTP/2]). However, they are sometimes used to implement reactive client certificate authentication in HTTP/1.1 [HTTP/1.1] where the server decides whether to request a client certificate based on the HTTP request. HTTP application data sent on such a connection after receipt and verification of the client certificate is also mutually authenticated and thus suitable for the mechanisms described in this document. With post-handshake authentication, there is also the possibility, though unlikely in practice, of multiple certificates and certificate chains from the client on a connection. In this case, only the certificate and chain of the last post-handshake authentication are to be utilized for the header fields described herein.¶
2. HTTP Header Fields and Processing Rules
This document designates the following headers, defined further in Sections 2.2 and 2.3, respectively, to carry the client certificate information of a mutually authenticated TLS connection. The headers convey the information from the reverse proxy to the origin server.¶
- Client-Cert:
- The end-entity certificate used by the client in the TLS handshake with the reverse proxy.¶
- Client
-Cert -Chain : - The certificate chain used for validation of the end-entity certificate provided by the client in the TLS handshake with the reverse proxy.¶
2.1. Encoding
The headers in this document encode certificates as Byte Sequences
(Section 3.3.5 of [STRUCTURED
Note that certificates are often stored in an encoded textual format, such as the one described in Section 5.1 of [RFC7468], which is already nearly compatible with a Byte Sequence. If certificates are encoded as such, it will be sufficient to replace "---(BEGIN|END) CERTIFICATE---" with ":" and remove line breaks in order to generate an appropriate item.¶
2.2. Client-Cert HTTP Header Field
In the context of a TLS terminating reverse proxy deployment, the proxy makes the TLS client certificate available to the backend application with the Client-Cert HTTP header field. This field contains the end-entity certificate used by the client in the TLS handshake.¶
Client-Cert is a Byte Sequence with the value of the header encoded as described in Section 2.1.¶
The Client-Cert header field is only for use in HTTP requests and MUST NOT be used in HTTP responses. It is a singleton header field value as defined in Section 5.5 of [HTTP], which MUST NOT have a list of values or occur multiple times in a request.¶
Figure 2 in Appendix A has an example of the Client-Cert header field.¶
2.3. Client-Cert-Chain HTTP Header Field
In the context of a TLS terminating reverse proxy deployment, the proxy
MAY make the certificate chain
available to the backend application with the Client
Client
Client
The Client
Figure 3 in Appendix A has an example of the Client
2.4. Processing Rules
This section outlines the applicable processing rules for a TTRP that has negotiated a mutually authenticated TLS connection to convey the client certificate from that connection to the backend origin servers. This technique is to be used as a configuration or deployment option, and the processing rules described herein are for servers operating with that option enabled.¶
A TTRP negotiates the use of a mutually authenticated TLS connection with the client, such as is described in [TLS] or [TLS1.2], and validates the client certificate per its policy and trusted certificate authorities. Each HTTP request on the underlying TLS connection is dispatched to the origin server with the following modifications:¶
Requests to the TTRP made over a TLS connection where the use of client certificate
authentication was not negotiated MUST be sanitized by removing any and all
occurrences of the Client-Cert and Client
Backend origin servers may then use the Client-Cert header field of the request to determine if the connection from the client to the TTRP was mutually authenticated and, if so, the certificate thereby presented by the client. Access control decisions based on the client certificate (or lack thereof) can be conveyed by selecting response content as appropriate or with an HTTP 403 response, if the certificate is deemed unacceptable for the given context. Note that TLS clients that rely on error indications at the TLS layer for an unacceptable certificate will not receive those signals.¶
When the value of the Client-Cert request header field is
used to select a response (e.g., the response content is
access
Forward proxies and other intermediaries MUST NOT
add the Client-Cert or Client
3. Deployment Considerations
3.1. Header Field Compression
If the connection between the TTRP and origin is capable of field
compression (e.g., HPACK [HPACK]
or QPACK [QPACK]), and the TTRP
multiplexes more than one client's requests into that connection, the
size and variation of Client-Cert and
Client
3.2. Message Header Size
A server in receipt of a larger message header than it is willing to handle can send an HTTP 431 (Request Header Fields Too Large) status code per Section 5 of [RFC6585]. Due to the typical size of the field values containing certificate data, recipients may need to be configured to allow for a larger maximum header size. An intermediary generating client certificate header fields on connections that allow for advertising the maximum acceptable header size (e.g., HTTP/2 [HTTP/2] or HTTP/3 [HTTP/3]) should account for the additional size of the header of the requests it sends, versus the requests it receives, by advertising a value to its clients that is sufficiently smaller so as to allow for the addition of certificate data.¶
3.3. TLS Session Resumption
Some TLS implementations do not retain client certificate
information when resuming. Providing inconsistent values of
Client-Cert and Client
4. Security Considerations
The header fields described herein enable a TTRP and backend or origin server to function together as though, from the client's perspective, they are a single logical server-side deployment of HTTPS over a mutually authenticated TLS connection. However, use of the header fields outside that intended use case may undermine the protections afforded by TLS client certificate authentication. Therefore, steps such as those described below need to be taken to prevent unintended use, both in sending the header field and in relying on its value.¶
Producing and consuming the Client-Cert and Client
In order to prevent field injection, backend servers MUST only accept the
Client-Cert and Client
The communication between a TTRP and backend server needs to be secured against eavesdropping and modification by unintended parties.¶
The configuration options and request sanitization are necessary functionalities
of the respective servers. The other requirements can be met in a number of
ways, which will vary based on specific deployments. The communication between a
TTRP and backend or origin server, for example, might be authenticated in some
way with the insertion and consumption of the Client-Cert
and Client
5. IANA Considerations
5.1. HTTP Field Name Registrations
IANA has registered the following entries in the "Hypertext Transfer Protocol (HTTP) Field Name Registry" defined by "HTTP Semantics" [HTTP]:¶
6. References
6.1. Normative References
- [HTTP]
-
Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, Ed., "HTTP Semantics", STD 97, RFC 9110, DOI 10
.17487 , , <https:///RFC9110 www >..rfc -editor .org /info /rfc9110 - [ITU.X690]
-
ITU-T, "Information technology - ASN.1 encoding rules: Specification of Basic Encoding Rules (BER), Canonical Encoding Rules (CER) and Distinguished Encoding Rules (DER)", ITU-T Recommendation X.690, , <https://
www >..itu .int /rec /T -REC -X .690 /en - [RFC2119]
-
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10
.17487 , , <https:///RFC2119 www >..rfc -editor .org /info /rfc2119 - [RFC5280]
-
Cooper, D., Santesson, S., Farrell, S., Boeyen, S., Housley, R., and W. Polk, "Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile", RFC 5280, DOI 10
.17487 , , <https:///RFC5280 www >..rfc -editor .org /info /rfc5280 - [RFC8174]
-
Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10
.17487 , , <https:///RFC8174 www >..rfc -editor .org /info /rfc8174 - [STRUCTURED
-FIELDS] -
Nottingham, M. and P-H. Kamp, "Structured Field Values for HTTP", RFC 8941, DOI 10
.17487 , , <https:///RFC8941 www >..rfc -editor .org /info /rfc8941
6.2. Informative References
- [HPACK]
-
Peon, R. and H. Ruellan, "HPACK: Header Compression for HTTP/2", RFC 7541, DOI 10
.17487 , , <https:///RFC7541 www >..rfc -editor .org /info /rfc7541 - [HTTP/1.1]
-
Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, Ed., "HTTP/1.1", STD 99, RFC 9112, DOI 10
.17487 , , <https:///RFC9112 www >..rfc -editor .org /info /rfc9112 - [HTTP/2]
-
Thomson, M., Ed. and C. Benfield, Ed., "HTTP/2", RFC 9113, DOI 10
.17487 , , <https:///RFC9113 www >..rfc -editor .org /info /rfc9113 - [HTTP/3]
-
Bishop, M., Ed., "HTTP/3", RFC 9114, DOI 10
.17487 , , <https:///RFC9114 www >..rfc -editor .org /info /rfc9114 - [HTTPSIG]
-
Backman, A., Ed., Richer, J., Ed., and M. Sporny, "HTTP Message Signatures", Work in Progress, Internet-Draft, draft
-ietf , , <https://-httpbis -message -signatures -17 datatracker >..ietf .org /doc /html /draft -ietf -httpbis -message -signatures -17 - [QPACK]
-
Krasic, C., Bishop, M., and A. Frindell, Ed., "QPACK: Field Compression for HTTP/3", RFC 9204, DOI 10
.17487 , , <https:///RFC9204 www >..rfc -editor .org /info /rfc9204 - [RFC6585]
-
Nottingham, M. and R. Fielding, "Additional HTTP Status Codes", RFC 6585, DOI 10
.17487 , , <https:///RFC6585 www >..rfc -editor .org /info /rfc6585 - [RFC7239]
-
Petersson, A. and M. Nilsson, "Forwarded HTTP Extension", RFC 7239, DOI 10
.17487 , , <https:///RFC7239 www >..rfc -editor .org /info /rfc7239 - [RFC7468]
-
Josefsson, S. and S. Leonard, "Textual Encodings of PKIX, PKCS, and CMS Structures", RFC 7468, DOI 10
.17487 , , <https:///RFC7468 www >..rfc -editor .org /info /rfc7468 - [RFC8705]
-
Campbell, B., Bradley, J., Sakimura, N., and T. Lodderstedt, "OAuth 2.0 Mutual-TLS Client Authentication and Certificate
-Bound , RFC 8705, DOI 10Access Tokens" .17487 , , <https:///RFC8705 www >..rfc -editor .org /info /rfc8705 - [TLS]
-
Rescorla, E., "The Transport Layer Security (TLS) Protocol Version 1.3", RFC 8446, DOI 10
.17487 , , <https:///RFC8446 www >..rfc -editor .org /info /rfc8446 - [TLS1.2]
-
Dierks, T. and E. Rescorla, "The Transport Layer Security (TLS) Protocol Version 1.2", RFC 5246, DOI 10
.17487 , , <https:///RFC5246 www >..rfc -editor .org /info /rfc5246
Appendix A. Example
In a hypothetical example where a TLS client would present the client and intermediate certificate from Figure 1 when establishing a mutually authenticated TLS connection with the TTRP, the proxy would send the Client-Cert field shown in Figure 2 to the backend. Note that line breaks and extra spaces have been added to the field value in Figures 2 and 3 for display and formatting purposes only.¶
If the proxy were configured to also include the certificate chain, it would
also include the Client
Appendix B. Select Design Considerations
B.1. Field Injection
This document requires that the TTRP sanitize the fields of the incoming request by
removing or overwriting any existing instances of the Client-Cert
and Client
B.2. The Forwarded HTTP Extension
The Forwarded HTTP header field defined in [RFC7239] allows proxy components to disclose information
lost in the proxying process. The TLS client certificate information
of concern to this document could have been communicated with an
extension parameter to the Forwarded field; however, doing so
would have had some disadvantages that this document endeavored to
avoid. The Forwarded field syntax allows for information
about a full chain of proxied HTTP requests, whereas the
Client-Cert and Client
B.3. The Whole Certificate and Certificate Chain
Different applications will have varying requirements about what information from the client certificate is needed, such as the subject and/or issuer distinguished name, subject alternative name(s), serial number, subject public key info, fingerprint, etc. Furthermore, some applications, such as that described in [RFC8705], make use of the entire certificate. In order to accommodate the latter and ensure wide applicability by not trying to cherry-pick particular certificate information, this document opted to pass the full, encoded certificate as the value of the Client-Cert field.¶
The validation of the client certificate and chain of the mutually
authenticated TLS connection is typically performed by the TTRP during
the handshake. With the responsibility of certificate validation
falling on the TTRP, the end-entity certificate is oftentimes
sufficient for the needs of the origin server. The separate
Client
Acknowledgements
The authors would like to thank the following individuals who have contributed to this document in various ways, ranging from just being generally supportive of bringing forth the document to providing specific feedback or content:¶