| draft-ietf-httpbis-connect-tcp-16.txt | draft-ietf-httpbis-connect-tcp-latest.txt | |||
|---|---|---|---|---|
| httpbis Working Group B. Schwartz | httpbis Working Group B. Schwartz | |||
| Internet-Draft Meta Platforms, Inc. | Internet-Draft Meta Platforms, Inc. | |||
| Intended status: Standards Track October 16, 2026 | Intended status: Standards Track November 22, 2026 | |||
| Expires: April 19, 2027 | Expires: May 26, 2027 | |||
| Template-Driven HTTP CONNECT Proxying for TCP | Template-Driven HTTP CONNECT Proxying for TCP | |||
| draft-ietf-httpbis-connect-tcp-16 | draft-ietf-httpbis-connect-tcp-latest | |||
| Abstract | Abstract | |||
| TCP tunneling using HTTP CONNECT has long been part of the core HTTP | TCP tunneling using HTTP CONNECT has long been part of the core HTTP | |||
| specification. However, this tunneling functionality has several | specification. However, this tunneling functionality has several | |||
| important deficiencies due to the lack of a well-defined HTTP origin | important deficiencies due to the lack of a well-defined HTTP origin | |||
| or path. This specification defines an alternative HTTP proxy | or path. This specification remedies those deficiencies by defining | |||
| service configuration for TCP connections. This configuration is | CONNECT-TCP, an alternative protocol for tunneling TCP in HTTP. A | |||
| described by a URI Template, similar to the CONNECT-UDP and CONNECT- | proxy service for this protocol is described by a URI Template, | |||
| IP protocols. | similar to the CONNECT-UDP and CONNECT-IP protocols. | |||
| Status of This Memo | Status of This Memo | |||
| This Internet-Draft is submitted in full conformance with the | This Internet-Draft is submitted in full conformance with the | |||
| provisions of BCP 78 and BCP 79. | provisions of BCP 78 and BCP 79. | |||
| Internet-Drafts are working documents of the Internet Engineering | Internet-Drafts are working documents of the Internet Engineering | |||
| Task Force (IETF). Note that other groups may also distribute | Task Force (IETF). Note that other groups may also distribute | |||
| working documents as Internet-Drafts. The list of current Internet- | working documents as Internet-Drafts. The list of current Internet- | |||
| Drafts is at https://datatracker.ietf.org/drafts/current/. | Drafts is at https://datatracker.ietf.org/drafts/current/. | |||
| Internet-Drafts are draft documents valid for a maximum of six months | Internet-Drafts are draft documents valid for a maximum of six months | |||
| and may be updated, replaced, or obsoleted by other documents at any | and may be updated, replaced, or obsoleted by other documents at any | |||
| time. It is inappropriate to use Internet-Drafts as reference | time. It is inappropriate to use Internet-Drafts as reference | |||
| material or to cite them other than as "work in progress." | material or to cite them other than as "work in progress." | |||
| This Internet-Draft will expire on April 19, 2027. | This Internet-Draft will expire on May 26, 2027. | |||
| Copyright Notice | Copyright Notice | |||
| Copyright (c) 2026 IETF Trust and the persons identified as the | Copyright (c) 2026 IETF Trust and the persons identified as the | |||
| document authors. All rights reserved. | document authors. All rights reserved. | |||
| This document is subject to BCP 78 and the IETF Trust's Legal | This document is subject to BCP 78 and the IETF Trust's Legal | |||
| Provisions Relating to IETF Documents | Provisions Relating to IETF Documents | |||
| (https://trustee.ietf.org/license-info) in effect on the date of | (https://trustee.ietf.org/license-info) in effect on the date of | |||
| publication of this document. Please review these documents | publication of this document. Please review these documents | |||
| skipping to change at page 2, line 15 ¶ | skipping to change at page 2, line 15 ¶ | |||
| described in the Simplified BSD License. | described in the Simplified BSD License. | |||
| Table of Contents | Table of Contents | |||
| 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 | 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 | |||
| 1.1. History . . . . . . . . . . . . . . . . . . . . . . . . . 3 | 1.1. History . . . . . . . . . . . . . . . . . . . . . . . . . 3 | |||
| 1.2. Problems . . . . . . . . . . . . . . . . . . . . . . . . 3 | 1.2. Problems . . . . . . . . . . . . . . . . . . . . . . . . 3 | |||
| 1.3. Overview . . . . . . . . . . . . . . . . . . . . . . . . 3 | 1.3. Overview . . . . . . . . . . . . . . . . . . . . . . . . 3 | |||
| 2. Conventions and Definitions . . . . . . . . . . . . . . . . . 4 | 2. Conventions and Definitions . . . . . . . . . . . . . . . . . 4 | |||
| 3. Specification . . . . . . . . . . . . . . . . . . . . . . . . 4 | 3. Specification . . . . . . . . . . . . . . . . . . . . . . . . 4 | |||
| 3.1. In HTTP/1.1 . . . . . . . . . . . . . . . . . . . . . . . 5 | 3.1. Payload Transport . . . . . . . . . . . . . . . . . . . . 4 | |||
| 3.2. In HTTP/2 and HTTP/3 . . . . . . . . . . . . . . . . . . 7 | 3.2. In HTTP/1.1 . . . . . . . . . . . . . . . . . . . . . . . 6 | |||
| 3.3. Use of Other Relevant Headers . . . . . . . . . . . . . . 8 | 3.3. In HTTP/2 and HTTP/3 . . . . . . . . . . . . . . . . . . 7 | |||
| 3.3.1. Origin-scoped Headers . . . . . . . . . . . . . . . . 8 | 3.4. Use of Other Relevant Headers . . . . . . . . . . . . . . 8 | |||
| 3.3.2. Authentication Headers . . . . . . . . . . . . . . . 8 | 3.4.1. Origin-scoped Headers . . . . . . . . . . . . . . . . 8 | |||
| 3.3.3. Caching Headers . . . . . . . . . . . . . . . . . . . 9 | 3.4.2. Authentication Headers . . . . . . . . . . . . . . . 8 | |||
| 3.4. Closing Connections . . . . . . . . . . . . . . . . . . . 9 | 3.4.3. Caching Headers . . . . . . . . . . . . . . . . . . . 9 | |||
| 3.4.1. Handling Invalid Data . . . . . . . . . . . . . . . . 11 | 3.5. Closing Connections . . . . . . . . . . . . . . . . . . . 9 | |||
| 3.5.1. Handling Invalid Data . . . . . . . . . . . . . . . . 11 | ||||
| 4. Additional Connection Setup Behaviors . . . . . . . . . . . . 11 | 4. Additional Connection Setup Behaviors . . . . . . . . . . . . 11 | |||
| 4.1. Latency optimizations . . . . . . . . . . . . . . . . . . 12 | 4.1. Latency Optimizations . . . . . . . . . . . . . . . . . . 12 | |||
| 4.2. Indicating Failure . . . . . . . . . . . . . . . . . . . 12 | 4.2. Indicating Failure . . . . . . . . . . . . . . . . . . . 12 | |||
| 4.3. Conveying metadata . . . . . . . . . . . . . . . . . . . 13 | 4.3. Conveying Metadata . . . . . . . . . . . . . . . . . . . 13 | |||
| 5. Applicability . . . . . . . . . . . . . . . . . . . . . . . . 13 | 5. Applicability . . . . . . . . . . . . . . . . . . . . . . . . 13 | |||
| 5.1. Servers . . . . . . . . . . . . . . . . . . . . . . . . . 13 | 5.1. Servers . . . . . . . . . . . . . . . . . . . . . . . . . 13 | |||
| 5.2. Clients . . . . . . . . . . . . . . . . . . . . . . . . . 14 | 5.2. Clients . . . . . . . . . . . . . . . . . . . . . . . . . 14 | |||
| 5.3. Gateways . . . . . . . . . . . . . . . . . . . . . . . . 15 | 5.3. Gateways . . . . . . . . . . . . . . . . . . . . . . . . 15 | |||
| 6. Security Considerations . . . . . . . . . . . . . . . . . . . 15 | 6. Security Considerations . . . . . . . . . . . . . . . . . . . 15 | |||
| 6.1. Resource Exhaustion attacks . . . . . . . . . . . . . . . 16 | 6.1. Resource Exhaustion attacks . . . . . . . . . . . . . . . 16 | |||
| 6.2. Client Authentication . . . . . . . . . . . . . . . . . . 17 | ||||
| 6.3. TLS Early Data . . . . . . . . . . . . . . . . . . . . . 17 | ||||
| 7. Operational Considerations . . . . . . . . . . . . . . . . . 17 | 7. Operational Considerations . . . . . . . . . . . . . . . . . 17 | |||
| 7.1. Avoiding HTTP/1.1 . . . . . . . . . . . . . . . . . . . . 17 | 7.1. Avoiding HTTP/1.1 . . . . . . . . . . . . . . . . . . . . 17 | |||
| 7.2. Timeouts . . . . . . . . . . . . . . . . . . . . . . . . 18 | 7.2. Timeouts . . . . . . . . . . . . . . . . . . . . . . . . 18 | |||
| 7.3. IP address sharing . . . . . . . . . . . . . . . . . . . 18 | 7.3. Scope of Packet-Level Metadata . . . . . . . . . . . . . 19 | |||
| 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 18 | 7.4. IP address sharing . . . . . . . . . . . . . . . . . . . 19 | |||
| 8.1. New Upgrade Token . . . . . . . . . . . . . . . . . . . . 18 | 7.5. Diagnostics and Monitoring . . . . . . . . . . . . . . . 19 | |||
| 8.1.1. Interop testing . . . . . . . . . . . . . . . . . . . 18 | 8. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 20 | |||
| 8.2. New MASQUE Default Template . . . . . . . . . . . . . . . 19 | 8.1. New Upgrade Token . . . . . . . . . . . . . . . . . . . . 20 | |||
| 8.3. New Capsule Type . . . . . . . . . . . . . . . . . . . . 19 | 8.1.1. Interop testing . . . . . . . . . . . . . . . . . . . 20 | |||
| 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 19 | 8.2. New MASQUE Default Template . . . . . . . . . . . . . . . 20 | |||
| 9.1. Normative References . . . . . . . . . . . . . . . . . . 19 | 8.3. New Capsule Type . . . . . . . . . . . . . . . . . . . . 20 | |||
| 9.2. Informative References . . . . . . . . . . . . . . . . . 21 | 9. References . . . . . . . . . . . . . . . . . . . . . . . . . 21 | |||
| Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 22 | 9.1. Normative References . . . . . . . . . . . . . . . . . . 21 | |||
| Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 22 | 9.2. Informative References . . . . . . . . . . . . . . . . . 22 | |||
| Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . 25 | ||||
| Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 25 | ||||
| 1. Introduction | 1. Introduction | |||
| 1.1. History | 1.1. History | |||
| HTTP has used the CONNECT method for tunneling TCP connections since | HTTP has used the CONNECT method for tunneling TCP connections since | |||
| HTTP/1.1. When using CONNECT, the request target specifies a host | HTTP/1.1. When using CONNECT, the request target specifies a host | |||
| and port number, and the proxy forwards TCP payloads between the | and port number, and the proxy forwards TCP payloads between the | |||
| client and the target destination ([HTTP], Section 9.3.6). To date, | client and the target destination ([HTTP], Section 9.3.6). Prior to | |||
| this is the only mechanism defined for proxying TCP over HTTP. In | this specification, this was the only mechanism defined for proxying | |||
| this specification, this is referred to as a "classic HTTP CONNECT | TCP over HTTP. In this specification, this arrangement is referred | |||
| proxy". | to as a "classic HTTP CONNECT proxy". | |||
| HTTP/3 [RFC9114] uses a UDP transport, so it cannot be forwarded | HTTP/3 [RFC9114] uses a UDP transport, so it cannot be forwarded | |||
| using the pre-existing CONNECT mechanism. To enable forward proxying | using the pre-existing CONNECT mechanism. To enable forward proxying | |||
| of HTTP/3, the MASQUE effort has defined proxy mechanisms that are | of HTTP/3, the MASQUE effort has defined proxy mechanisms that are | |||
| capable of tunneling UDP datagrams [CONNECT-UDP], and more generally | capable of tunneling UDP datagrams [CONNECT-UDP], and more generally | |||
| IP datagrams [CONNECT-IP]. The destination host and port number (if | IP datagrams [CONNECT-IP]. The destination host and port number (if | |||
| applicable) are encoded into the HTTP resource path, and end-to-end | applicable) are encoded into the HTTP resource path, and end-to-end | |||
| datagrams are wrapped into HTTP Datagrams [CAPSULE] on the client- | datagrams are wrapped into HTTP Datagrams [CAPSULE] on the client- | |||
| proxy path. | proxy path. | |||
| skipping to change at page 3, line 40 ¶ | skipping to change at page 3, line 40 ¶ | |||
| However, classic HTTP CONNECT requests using the proxy do not carry | However, classic HTTP CONNECT requests using the proxy do not carry | |||
| this configuration information. Instead, they only indicate the | this configuration information. Instead, they only indicate the | |||
| hostname and port of the target. This prevents any HTTP server from | hostname and port of the target. This prevents any HTTP server from | |||
| hosting multiple distinct proxy services, as the server cannot | hosting multiple distinct proxy services, as the server cannot | |||
| distinguish them by path (as with distinct resources) or by origin | distinguish them by path (as with distinct resources) or by origin | |||
| (as in "virtual hosting"). | (as in "virtual hosting"). | |||
| The absence of an explicit origin for the proxy also rules out the | The absence of an explicit origin for the proxy also rules out the | |||
| usual defenses against server port misdirection attacks (see | usual defenses against server port misdirection attacks (see | |||
| Section 7.4 of [HTTP]) and creates ambiguity about the use of origin- | Section 7.4 of [HTTP]) and creates ambiguity about the use of origin- | |||
| scoped response header fields (e.g., "Alt-Svc" [ALT-SVC] or "Strict- | scoped response header fields (e.g., Alt-Svc [ALT-SVC] or Strict- | |||
| Transport-Security" [HSTS]). | Transport-Security [HSTS]). | |||
| Classic HTTP CONNECT requests are not extensible to carry in-stream | Classic HTTP CONNECT requests are not extensible to carry in-stream | |||
| metadata. For example, the WRAP_UP capsule | metadata. For example, the WRAP_UP capsule | |||
| [I-D.ietf-httpbis-wrap-up] cannot be used with classic HTTP CONNECT. | [I-D.ietf-httpbis-wrap-up] cannot be used with classic HTTP CONNECT. | |||
| 1.3. Overview | 1.3. Overview | |||
| This specification describes an alternative mechanism for tunneling | This specification describes an alternative mechanism for tunneling | |||
| TCP in HTTP. Like [CONNECT-UDP] and [CONNECT-IP], the proxy service | TCP in HTTP. Like [CONNECT-UDP] and [CONNECT-IP], the proxy service | |||
| is identified by a URI Template. Proxy interactions reuse standard | is identified by a URI Template. Proxy interactions reuse standard | |||
| skipping to change at page 4, line 24 ¶ | skipping to change at page 4, line 24 ¶ | |||
| In this document, the term "proxy" refers to the HTTP server that | In this document, the term "proxy" refers to the HTTP server that | |||
| acts upon a client's TCP tunneling request. If there are HTTP | acts upon a client's TCP tunneling request. If there are HTTP | |||
| intermediaries (as defined in Section 3.7 of [HTTP]) between the | intermediaries (as defined in Section 3.7 of [HTTP]) between the | |||
| client and the proxy, those are referred to as "intermediaries" or | client and the proxy, those are referred to as "intermediaries" or | |||
| "gateways" in this document. | "gateways" in this document. | |||
| The term "endpoint" describes an implementation of this specification | The term "endpoint" describes an implementation of this specification | |||
| in either client or proxy role. | in either client or proxy role. | |||
| The term "templated TCP proxy" refers to a proxy that is identified | The protocol defined in this specification is termed "CONNECT-TCP". | |||
| by a URI Template in accordance with this specification. | ||||
| The term "CONNECT-TCP proxy" refers to a proxy that is identified by | ||||
| a URI Template for CONNECT-TCP. | ||||
| 3. Specification | 3. Specification | |||
| A template-driven TCP transport proxy for HTTP is identified by a URI | A template-driven TCP transport proxy for HTTP is identified by a URI | |||
| Template [RFC6570] containing variables named "target_host" and | Template [RFC6570] containing variables named "target_host" and | |||
| "target_port". This URI Template and its variable values MUST meet | "target_port". This URI Template and its variable values MUST meet | |||
| all the same requirements as for UDP proxying ([CONNECT-UDP], | all the same requirements as for UDP proxying (Sections 2 and 3 of | |||
| Section 2), and are subject to the same validation rules. Clients | [CONNECT-UDP]), and are subject to the same validation rules. | |||
| MUST substitute the destination host and port number into this | Clients MUST substitute the destination host and port number into | |||
| template to produce a request URI. The derived URI serves as the | this template to produce a request URI. The derived URI serves as | |||
| destination of a Capsule Protocol connection using the Upgrade Token | the destination of a Capsule Protocol connection using the Upgrade | |||
| "connect-tcp" (see registration in Section 8.1). | Token "connect-tcp" (see registration in Section 8.1). | |||
| When using "connect-tcp", TCP payload data is sent in the payload of | If the request is well-formed and permissible, the proxy MUST attempt | |||
| to establish the TCP connection before sending a final success or | ||||
| failure response. | ||||
| 3.1. Payload Transport | ||||
| When using CONNECT-TCP, TCP payload data is sent in the payload of | ||||
| new Capsule Types named DATA and FINAL_DATA (see Figure 1 and | new Capsule Types named DATA and FINAL_DATA (see Figure 1 and | |||
| registrations in Section 8.3). The ordered concatenation of these | registrations in Section 8.3). The ordered concatenation of these | |||
| capsule payloads, which MAY be empty, represents the TCP payload | capsule payloads, which MAY be empty, represents the TCP payload | |||
| data. A FINAL_DATA capsule additionally indicates that the sender | data. A FINAL_DATA capsule additionally indicates that the sender | |||
| has closed this stream, semantically equivalent to TCP FIN. After | has closed this stream, semantically equivalent to TCP FIN. After | |||
| sending a FINAL_DATA capsule, an endpoint MUST NOT send any more DATA | sending a FINAL_DATA capsule, an endpoint MUST NOT send any more DATA | |||
| or FINAL_DATA capsules on this data stream. See Section 3.4 for | or FINAL_DATA capsules on this data stream. See Section 3.5 for | |||
| related requirements. | related requirements. | |||
| DATA Capsule { | DATA Capsule { | |||
| Type (i) = 0x08, | Type (i) = 0x08, | |||
| Length (i), # may be zero | Length (i), # may be zero | |||
| TCP Payload (..), | TCP Payload (..), | |||
| } | } | |||
| FINAL_DATA Capsule { | FINAL_DATA Capsule { | |||
| Type (i) = 0x09, | Type (i) = 0x09, | |||
| Length (i), # may be zero | Length (i), # may be zero | |||
| TCP Payload (..), | TCP Payload (..), | |||
| } | } | |||
| Figure 1: DATA and FINAL_DATA Capsule Formats | Figure 1: DATA and FINAL_DATA Capsule Formats, using notation from | |||
| Section 1.3 of [QUIC] | ||||
| The boundaries between DATA and FINAL_DATA capsules are not | The boundaries between DATA and FINAL_DATA capsules are not | |||
| significant, and are not expected to match TCP segments, TLS records, | significant, and are not expected to match TCP segments, TLS records, | |||
| HTTP DATA frames, QUIC STREAM frames, etc. Recipients SHOULD begin | HTTP DATA frames, QUIC STREAM frames, etc. Recipients SHOULD begin | |||
| forwarding payload from a DATA or FINAL_DATA capsule without waiting | forwarding payload from a DATA or FINAL_DATA capsule without waiting | |||
| to receive the entire capsule, especially if the capsule is large. | to receive the entire capsule, especially if the capsule is large. | |||
| An intermediary MAY merge and split successive DATA and FINAL_DATA | An intermediary MAY merge and split successive DATA and FINAL_DATA | |||
| capsules, subject to the following requirements: | capsules, subject to the following requirements: | |||
| skipping to change at page 5, line 43 ¶ | skipping to change at page 6, line 5 ¶ | |||
| FINAL_DATA) as the final input capsule, and all others use the | FINAL_DATA) as the final input capsule, and all others use the | |||
| DATA capsule type. | DATA capsule type. | |||
| For example, an intermediary holding two successive DATA capsules in | For example, an intermediary holding two successive DATA capsules in | |||
| its transmission buffer could merge them, saving at least 2 bytes of | its transmission buffer could merge them, saving at least 2 bytes of | |||
| encapsulation overhead when they are forwarded. | encapsulation overhead when they are forwarded. | |||
| This protocol supports backward-compatible extensions via additional | This protocol supports backward-compatible extensions via additional | |||
| Capsule Types, as described in Section 3.2 of [CAPSULE]. | Capsule Types, as described in Section 3.2 of [CAPSULE]. | |||
| 3.1. In HTTP/1.1 | 3.2. In HTTP/1.1 | |||
| In HTTP/1.1 [RFC9112], the client uses the proxy by issuing a request | In HTTP/1.1 [RFC9112], the client uses the proxy by issuing a request | |||
| as follows: | as follows: | |||
| o The method SHALL be "GET". | o The method SHALL be GET. | |||
| o The request's target SHALL correspond to the URI derived from | o The request's target SHALL correspond to the URI derived from | |||
| expansion of the proxy's URI Template. | expansion of the proxy's URI Template. | |||
| o The request SHALL include a single "Host" header field whose value | o The request SHALL include a single Host header field whose value | |||
| identifies the proxy. | identifies the proxy. | |||
| o The request SHALL include a "Connection" header field with the | o The request SHALL include a Connection header field with the value | |||
| value "Upgrade". (Note that this requirement is case-insensitive | "Upgrade". (Note that this requirement is case-insensitive as per | |||
| as per Section 7.6.1 of [HTTP].) | Section 7.6.1 of [HTTP].) | |||
| o The request SHALL include an "Upgrade" header field with the value | o The request SHALL include an Upgrade header field with the value | |||
| "connect-tcp". | "connect-tcp". | |||
| o The request SHOULD include a "Capsule-Protocol: ?1" header (as | o The request SHOULD include a "Capsule-Protocol: ?1" header field | |||
| recommended in [CAPSULE], Section 3.4). | (as recommended in [CAPSULE], Section 3.4). | |||
| If the request is well-formed and permissible, the proxy MUST attempt | If the TCP connection is successful, the response SHALL be as | |||
| to establish the TCP connection before sending any response status | follows: | |||
| code other than "100 (Continue)" (see Section 4.3). If the TCP | ||||
| connection is successful, the response SHALL be as follows: | ||||
| o The HTTP status code SHALL be "101 (Switching Protocols)". | o The HTTP status code SHALL be 101 (Switching Protocols). | |||
| o The response SHALL include a "Connection" header field with the | o The response SHALL include a Connection header field with the | |||
| value "Upgrade". | value "Upgrade". | |||
| o The response SHALL include a single "Upgrade" header field with | o The response SHALL include a single Upgrade header field with the | |||
| the value "connect-tcp". | value "connect-tcp". | |||
| o The response SHOULD include a "Capsule-Protocol: ?1" header (as | o The response SHOULD include a "Capsule-Protocol: ?1" header field | |||
| above). | (as above). | |||
| If a TCP connection was not established, the proxy MUST NOT switch | If a TCP connection was not established, the proxy MUST NOT switch | |||
| protocols to "connect-tcp", and the client MAY reuse this connection | protocols to CONNECT-TCP, and the client MAY reuse this connection | |||
| for additional HTTP requests. | for additional HTTP requests. | |||
| Client Proxy | ||||
| GET /proxy?target_host=192.0.2.1&target_port=443 HTTP/1.1 | GET /proxy?target_host=192.0.2.1&target_port=443 HTTP/1.1 | |||
| Host: example.com | Host: example.com | |||
| Connection: Upgrade | Connection: Upgrade | |||
| Upgrade: connect-tcp | Upgrade: connect-tcp | |||
| Capsule-Protocol: ?1 | Capsule-Protocol: ?1 | |||
| ** Proxy establishes a TCP connection to 192.0.2.1:443 ** | CONNECT-TCP in HTTP/1.1: Example request for a connection to | |||
| 192.0.2.1:443 via https://example.com/proxy{?target_host,target_port} | ||||
| HTTP/1.1 101 Switching Protocols | HTTP/1.1 100 Continue | |||
| Connection: Upgrade | ||||
| Upgrade: connect-tcp | ||||
| Capsule-Protocol: ?1 | ||||
| Proxy-Status: example.com | ||||
| Templated TCP proxy example in HTTP/1.1 | CONNECT-TCP in HTTP/1.1: Initial response | |||
| 3.2. In HTTP/2 and HTTP/3 | HTTP/1.1 101 Switching Protocols | |||
| Connection: Upgrade | ||||
| Upgrade: connect-tcp | ||||
| Capsule-Protocol: ?1 | ||||
| Proxy-Status: example.com | ||||
| CONNECT-TCP in HTTP/1.1: Final success response | ||||
| 3.3. In HTTP/2 and HTTP/3 | ||||
| In HTTP/2 and HTTP/3, the proxy MUST include | In HTTP/2 and HTTP/3, the proxy MUST include | |||
| SETTINGS_ENABLE_CONNECT_PROTOCOL in its SETTINGS frame [RFC8441] | SETTINGS_ENABLE_CONNECT_PROTOCOL in its SETTINGS frame [RFC8441] | |||
| [RFC9220]. The client uses the proxy by issuing an "extended | [RFC9220]. The client uses the proxy by issuing an "extended | |||
| CONNECT" request as follows: | CONNECT" request as follows: | |||
| o The :method pseudo-header field SHALL be "CONNECT". | o The :method pseudo-header field SHALL be CONNECT. | |||
| o The :protocol pseudo-header field SHALL be "connect-tcp". | o The :protocol pseudo-header field SHALL be "connect-tcp". | |||
| o The :authority pseudo-header field SHALL contain the authority of | o The :authority pseudo-header field SHALL contain the authority of | |||
| the proxy. | the proxy. | |||
| o The :path and :scheme pseudo-header fields SHALL contain the path | o The :path and :scheme pseudo-header fields SHALL contain the path | |||
| and scheme of the request URI derived from the proxy's URI | and scheme of the request URI derived from the proxy's URI | |||
| Template. | Template. | |||
| A templated TCP proxying request that does not conform to all of | A CONNECT-TCP request that does not conform to all of these | |||
| these requirements represents a client error (see [HTTP], | requirements represents a client error (see [HTTP], Section 15.5) and | |||
| Section 15.5) and may be malformed (see Section 8.1.1 of [RFC9113] | may be malformed (see Section 8.1.1 of [RFC9113] and Section 4.1.2 of | |||
| and Section 4.1.2 of [RFC9114]). | [RFC9114]). | |||
| Additionally, the "capsule-protocol" header field SHOULD be present | Additionally, the Capsule-Protocol header field SHOULD be present | |||
| with a value of "?1" (as recommended in [CAPSULE], Section 3.4). | with a value of "?1" (as recommended in [CAPSULE], Section 3.4). | |||
| HEADERS | HEADERS | |||
| :method = CONNECT | :method = CONNECT | |||
| :scheme = https | :scheme = https | |||
| :authority = templated-proxy.example | :authority = example.com | |||
| :path = /proxy?target_host=2001%3Adb8%3A%3A1&target_port=443 | :path = /proxy?target_host=2001%3Adb8%3A%3A1&target_port=443 | |||
| :protocol = connect-tcp | :protocol = connect-tcp | |||
| capsule-protocol = ?1 | capsule-protocol = ?1 | |||
| ... | ... | |||
| Templated TCP proxy example in HTTP/2 | CONNECT-TCP in HTTP/2: Example request to [2001:db8::1]:443 | |||
| 3.3. Use of Other Relevant Headers | 3.4. Use of Other Relevant Headers | |||
| 3.3.1. Origin-scoped Headers | 3.4.1. Origin-scoped Headers | |||
| Ordinary HTTP headers apply only to the single resource identified in | Ordinary HTTP headers apply only to the single resource identified in | |||
| the request or response. An origin-scoped HTTP header is a special | the request or response. An origin-scoped HTTP header is a special | |||
| response header that is intended to change the client's behavior for | response header that is intended to change the client's behavior for | |||
| subsequent requests to any resource on this origin. | subsequent requests to any resource on this origin. | |||
| Unlike classic HTTP CONNECT proxies, a templated TCP proxy has an | Unlike classic HTTP CONNECT proxies, a CONNECT-TCP proxy has an | |||
| unambiguous origin of its own. Origin-scoped headers apply to this | unambiguous origin of its own. Origin-scoped headers apply to this | |||
| origin when they are associated with a templated TCP proxy response. | origin when they are associated with a CONNECT-TCP response. Here | |||
| Here are some origin-scoped headers that could potentially be sent by | are some origin-scoped headers that could potentially be sent by a | |||
| a templated TCP proxy: | CONNECT-TCP proxy: | |||
| o "Alt-Svc" [ALT-SVC] | o Alt-Svc [ALT-SVC] | |||
| o "Strict-Transport-Security" [HSTS] | o Strict-Transport-Security [HSTS] | |||
| o "Accept-CH" [RFC8942] | o Accept-CH [RFC8942] | |||
| o "Set-Cookie" [RFC6265], which has configurable scope. | o Set-Cookie [RFC6265], which has configurable scope. | |||
| o "Clear-Site-Data" [CLEAR-SITE-DATA] | o Clear-Site-Data [CLEAR-SITE-DATA] | |||
| 3.3.2. Authentication Headers | 3.4.2. Authentication Headers | |||
| Authentication to a templated TCP proxy normally uses ordinary HTTP | Authentication to a CONNECT-TCP proxy normally uses ordinary HTTP | |||
| authentication via the "401 (Unauthorized)" response code, the "WWW- | authentication via the 401 (Unauthorized) response code, the WWW- | |||
| Authenticate" response header field, and the "Authorization" request | Authenticate response header field, and the Authorization request | |||
| header field ([HTTP], Section 11.6). A templated TCP proxy does not | header field ([HTTP], Section 11.6). A CONNECT-TCP proxy does not | |||
| use the "407 (Proxy Authentication Required)" response code and | use the 407 (Proxy Authentication Required) status code and related | |||
| related header fields ([HTTP], Section 11.7) because they do not | header fields ([HTTP], Section 11.7) because they do not traverse | |||
| traverse HTTP gateways (see Section 5.3). | HTTP gateways (see Section 5.3). | |||
| Clients SHOULD assume that all proxy resources generated by a single | Clients SHOULD assume that all proxy resources generated by a single | |||
| template share a protection space (i.e., a realm) ([HTTP], | template share a protection space (i.e., a realm) ([HTTP], | |||
| Section 11.5). For many authentication schemes, this will allow the | Section 11.5). For many authentication schemes, this will allow the | |||
| client to avoid waiting for a "401 (Unauthorized)" response before | client to avoid waiting for a 401 (Unauthorized) response before each | |||
| each new connection through the proxy. | new connection through the proxy. | |||
| TLS Client Certificate authentication can also be used (see | TLS Client Certificate authentication can also be used (see | |||
| Section 5.3). | Section 5.3). | |||
| 3.3.3. Caching Headers | 3.4.3. Caching Headers | |||
| In HTTP/2 and HTTP/3, this specification uses the CONNECT method, | In HTTP/2 and HTTP/3, this specification uses the CONNECT method, | |||
| which is not subject to caching ([HTTP], Section 9.3.6). However, in | which is not subject to caching ([HTTP], Section 9.3.6). However, in | |||
| HTTP/1.1, the method is GET, which in other usages can be cacheable. | HTTP/1.1, the method is GET, which in other usages can be cacheable. | |||
| To minimize discrepancies between HTTP versions, the following | To minimize discrepancies between HTTP versions, the following | |||
| requirements apply when using HTTP/1.1: | requirements apply when using HTTP/1.1: | |||
| o If the response has a heuristically cacheable status code ([HTTP], | o If the response has a heuristically cacheable status code ([HTTP], | |||
| Section 15.1), it SHOULD also carry a "Cache-Control: no-store" | Section 15.1), it SHOULD also carry a "Cache-Control: no-store" | |||
| header field. | header field ([HTTP-CACHING], Section 5.2). | |||
| * This can occur if the request is rejected or the connection | * This can occur if the request is rejected or the connection | |||
| fails. | fails. | |||
| o The proxy SHOULD NOT attach any other caching-related header | o The proxy SHOULD NOT attach any other caching-related header | |||
| fields to the response. | fields to the response. | |||
| 3.4. Closing Connections | 3.5. Closing Connections | |||
| Connection termination is essentially symmetrical for proxies and | Connection termination is essentially symmetrical for proxies and | |||
| their clients, which we refer to here as the "endpoints" of a | their clients, which we refer to here as the "endpoints" of a | |||
| request. | request. | |||
| When closing connections, endpoints are subject to the following | When closing connections, endpoints are subject to the following | |||
| requirements: | requirements: | |||
| o When an endpoint receives a valid TCP FIN, it MUST send a | o When an endpoint receives a valid TCP FIN, it MUST send a | |||
| FINAL_DATA capsule. | FINAL_DATA capsule. | |||
| skipping to change at page 11, line 28 ¶ | skipping to change at page 11, line 28 ¶ | |||
| +-----FIN--->+-------FINAL_DATA{""}----->+-----FIN--->| | +-----FIN--->+-------FINAL_DATA{""}----->+-----FIN--->| | |||
| | | | | | | | | | | |||
| | (FIN) | | (FIN) | | | (FIN) | | (FIN) | | |||
| |<---"abc"---+<----FINAL_DATA{"abc"}-----+<---"abc"---+ | |<---"abc"---+<----FINAL_DATA{"abc"}-----+<---"abc"---+ | |||
| | |<----QUIC.STREAM{FIN}------+ | | | |<----QUIC.STREAM{FIN}------+ | | |||
| +-----RST--->+-----H3_CONNECT_ERROR----->+-----RST--->| | +-----RST--->+-----H3_CONNECT_ERROR----->+-----RST--->| | |||
| | | | | | | | | | | |||
| RST after FIN example (HTTP/3) | RST after FIN example (HTTP/3) | |||
| 3.4.1. Handling Invalid Data | 3.5.1. Handling Invalid Data | |||
| An endpoint that receives invalid data from its peer is subject to | An endpoint that receives invalid data from its peer is subject to | |||
| the same requirements as when receiving an abrupt closure of the | the same requirements as when receiving an abrupt closure of the | |||
| receive stream (see Section 3.4). Some examples of invalid data | receive stream (see Section 3.5). Some examples of invalid data | |||
| include: | include: | |||
| o A second FINAL_DATA capsule. | o A second FINAL_DATA capsule. | |||
| o A DATA capsule after FINAL_DATA. | o A DATA capsule after FINAL_DATA. | |||
| o Data that results in a parsing error under the Capsule Protocol. | o Data that results in a parsing error under the Capsule Protocol. | |||
| o A capsule that is truncated by the end of the stream. | o A capsule that is truncated by the end of the stream. | |||
| skipping to change at page 12, line 5 ¶ | skipping to change at page 12, line 5 ¶ | |||
| Note that very large DATA and FINAL_DATA capsules are still valid, as | Note that very large DATA and FINAL_DATA capsules are still valid, as | |||
| they can be forwarded incrementally using a bounded memory buffer. | they can be forwarded incrementally using a bounded memory buffer. | |||
| 4. Additional Connection Setup Behaviors | 4. Additional Connection Setup Behaviors | |||
| This section discusses some behaviors that are permitted or | This section discusses some behaviors that are permitted or | |||
| recommended in order to enhance the performance or functionality of | recommended in order to enhance the performance or functionality of | |||
| connection setup. | connection setup. | |||
| 4.1. Latency optimizations | 4.1. Latency Optimizations | |||
| When using this specification in HTTP/2 or HTTP/3, clients MAY start | When using this specification in HTTP/2 or HTTP/3, clients MAY start | |||
| sending TCP stream content optimistically, subject to flow control | sending TCP stream content optimistically, subject to flow control | |||
| limits (Section 5.2 of [RFC9113] or Section 4.1 of [QUIC]). Proxies | limits (Section 5.2 of [RFC9113] or Section 4.1 of [QUIC]). Proxies | |||
| MUST buffer this "optimistic" content until the TCP stream becomes | MUST buffer this "optimistic" content until the TCP stream becomes | |||
| writable, and discard it if the TCP connection fails. (Clients MUST | writable, and discard it if the TCP connection fails. | |||
| NOT use "optimistic" behavior in HTTP/1.1, as this would interfere | ||||
| with reuse of the connection after an error response such as "401 | Clients MUST NOT use "optimistic" behavior in HTTP/1.1, as this would | |||
| (Unauthorized)".) | interfere with reuse of the connection after an error response such | |||
| as 401 (Unauthorized). | ||||
| Servers that host a proxy under this specification MAY offer support | Servers that host a proxy under this specification MAY offer support | |||
| for TLS early data in accordance with [RFC8470]. Clients MAY send | for TLS early data in accordance with [RFC8470]. Clients MAY send | |||
| "connect-tcp" requests in early data, and MAY include "optimistic" | CONNECT-TCP requests in early data, and MAY include "optimistic" TCP | |||
| TCP content in early data (in HTTP/2 and HTTP/3). At the TLS layer, | content in early data (in HTTP/2 and HTTP/3). At the TLS layer, | |||
| proxies MAY ignore, reject, or accept the "early_data" extension | proxies MAY ignore, reject, or accept the "early_data" extension | |||
| ([TLS], Section 4.3.10). At the HTTP layer, proxies MAY process the | ([TLS], Section 4.3.10). At the HTTP layer, proxies MAY process the | |||
| request immediately, return a "425 (Too Early)" response ([RFC8470], | request immediately, return a 425 (Too Early) response ([RFC8470], | |||
| Section 5.2), or delay some or all processing of the request until | Section 5.2), or delay some or all processing of the request until | |||
| the handshake completes. For example, a proxy with limited anti- | the handshake completes. For example, a proxy with limited anti- | |||
| replay defenses might choose to perform DNS resolution of the | replay defenses might choose to perform DNS resolution of | |||
| "target_host" when a request arrives in early data, but delay the TCP | "target_host" when a request arrives in early data, but delay the TCP | |||
| connection until the TLS handshake completes. | connection until the TLS handshake completes. | |||
| When DNS resolution of "target_host" produces multiple IP addresses, | When DNS resolution of "target_host" produces IP addresses from | |||
| proxies SHOULD use a racing procedure such as Happy Eyeballs [HEv2] | multiple address families, proxies SHOULD use a racing procedure such | |||
| to accelerate connection establishment. Proxies that race multiple | as Happy Eyeballs [HEv2] to accelerate connection establishment. | |||
| connection attempts MUST buffer any optimistic content until a | Proxies that race multiple connection attempts MUST buffer any | |||
| connection is selected and MUST NOT transmit any payload data on the | optimistic content until a connection is selected and MUST NOT | |||
| other connections. | transmit any payload data on the other connections. | |||
| 4.2. Indicating Failure | 4.2. Indicating Failure | |||
| Failure to initiate a tunnel is indicated by the HTTP response status | Failure to initiate a tunnel is indicated by the HTTP status code. | |||
| code. | ||||
| A 4XX status code indicates the the request is malformed or | A 4xx status code indicates that the request is malformed or | |||
| impermissible. For example, if the proxy performs DNS resolution of | impermissible. For example, if the proxy performs DNS resolution of | |||
| "target_host" and receives an IP address that is disallowed by the | "target_host" and receives an IP address that is disallowed by the | |||
| proxy's policy, it might return 403 (Forbidden). | proxy's policy, it might return 403 (Forbidden). | |||
| A 5XX status code indicates a failure in the attempt, such as when a | A 5xx status code indicates a failure in the attempt, such as when a | |||
| TCP connection was attempted but did not succeed. The 502 (Bad | TCP connection was attempted but did not succeed. The 502 (Bad | |||
| Gateway) and 504 (Gateway Timeout) status codes are commonly used. | Gateway) and 504 (Gateway Timeout) status codes are commonly used. | |||
| The 429 (Too Many Requests) and 503 (Service Unavailable) status | The 429 (Too Many Requests) and 503 (Service Unavailable) status | |||
| codes indicate a temporary failure, and can carry a "Retry-After" | codes indicate a temporary failure, and can carry a Retry-After | |||
| response header field. If included, this field applies to all | response header field ([HTTP], Section 10.2.3). If included, this | |||
| requests using this URI Template. | field applies to all requests using this URI Template. | |||
| 4.3. Conveying metadata | 4.3. Conveying Metadata | |||
| This specification supports the "Expect: 100-continue" request header | This specification supports the 100 (Continue) status code ([HTTP], | |||
| ([HTTP], Section 10.1.1) in any HTTP version. The "100 (Continue)" | Section 15.2.1) in any HTTP version. Proxies SHOULD send this status | |||
| status code confirms receipt of a request at the proxy without | code whenever they accept a request, without waiting for the proxy- | |||
| waiting for the proxy-destination TCP handshake to succeed or fail. | destination TCP handshake to succeed or fail. This allows for a few | |||
| Clients MAY send "Expect: 100-continue", and proxies MUST respect it | useful improvements: | |||
| by returning "100 (Continue)" if the request is not immediately | ||||
| rejected. This allows for a few useful improvements: | ||||
| o Clients can provide a clearer status indication while waiting for | o Clients can provide a clearer status indication while waiting for | |||
| the destination host to respond. (TCP handshakes can hang for | the destination host to respond. (TCP handshakes can hang for | |||
| several minutes before failing.) | several minutes before failing.) | |||
| o Clients can apply separate timeouts to the tunneling request and | o Clients can apply separate timeouts to the tunneling request and | |||
| connection establishment. | connection establishment. | |||
| o In HTTP/2 and HTTP/3, clients have the option to delay some or all | o In HTTP/2 and HTTP/3, clients have the option to delay some or all | |||
| of the optimistic payload data until after confirming that the | of the optimistic payload data until after confirming that the | |||
| request is permissible. This strategy reduces wasted effort when | request is permissible. This strategy reduces wasted effort when | |||
| the request is rejected. | the request is rejected. | |||
| Proxies implementing this specification SHOULD include a "Proxy- | Note that a client in this specification cannot send an "Expect: | |||
| Status" response header field [PROXY-STATUS] in any success or | 100-continue" request header field, because the request does not | |||
| failure response (i.e., status codes 101, 2XX, 4XX, or 5XX) to | include any "content" ([HTTP], Section 10.1.1). | |||
| support advanced client behaviors and diagnostics. Clients and | ||||
| proxies MUST NOT send trailer fields on "connect-tcp" streams. | Proxies implementing this specification SHOULD include a Proxy-Status | |||
| response header field [PROXY-STATUS] in any success or failure | ||||
| response (i.e., status codes 101, 2xx, 4xx, or 5xx) to support | ||||
| advanced client behaviors and diagnostics. Clients and proxies MUST | ||||
| NOT send trailer fields on CONNECT-TCP streams. | ||||
| 5. Applicability | 5. Applicability | |||
| 5.1. Servers | 5.1. Servers | |||
| For server operators, templated TCP proxies are particularly valuable | For server operators, CONNECT-TCP proxies are particularly valuable | |||
| in situations where virtual-hosting is needed, or where multiple | in situations where virtual-hosting is needed, or where multiple | |||
| proxies must share an origin. For example, the proxy might benefit | proxies must share an origin. For example, the proxy might benefit | |||
| from sharing an HTTP gateway that provides DDoS defense, performs | from sharing an HTTP gateway that provides DDoS defense, performs | |||
| request sanitization, or enforces user authorization (Section 5.3). | request sanitization, or enforces user authorization (Section 5.3). | |||
| Templated TCP proxies can also be made invisible to probes from | CONNECT-TCP proxies can also be made invisible to probes from | |||
| unauthorized clients: | unauthorized clients: | |||
| o The URI template can include a high-entropy path, similar to | o The URI template can include a high-entropy path, similar to | |||
| Capability URLs [CAPABILITY]. | Capability URLs [CAPABILITY]. | |||
| o The proxy can require HTTP Concealed Authentication ([CONCEALED], | o The proxy can require HTTP Concealed Authentication ([CONCEALED], | |||
| Section 6.4). | Section 6.4). | |||
| 5.2. Clients | 5.2. Clients | |||
| This specification does not require any specific type of | This specification does not require any specific type of | |||
| configuration input. Suitable configuration input types include: | configuration input. Suitable configuration input types include: | |||
| o A URI Template string, as described in Section 3. | o A URI Template string, as described in Section 3. | |||
| o An IP address or hostname, with optional or required port and | o An IP address or hostname, with optional or required port and | |||
| scheme (as often used to describe classic HTTP CONNECT proxies). | scheme (as often used to describe classic HTTP CONNECT proxies). | |||
| A corresponding templated TCP proxy might be found in two ways: | A corresponding CONNECT-TCP proxy might be found in two ways: | |||
| * At the default template for "connect-tcp" (Figure 2). | * At the default template for "connect-tcp" (Figure 2). | |||
| * In the "proxy" dictionary of a provisioning domain resource at | * In the "proxies" array of a provisioning domain resource | |||
| the corresponding .well-known URI | retrieved from the corresponding ".well-known" URI (Sections 2 | |||
| ([I-D.ietf-intarea-proxy-config], Section 2). | and 3 of [I-D.ietf-intarea-proxy-config]). | |||
| o A provisioning domain resource, configured directly or identified | o A provisioning domain resource, configured directly or identified | |||
| by a local or remote URI (e.g., using "file://" or "https://"). | by a local or remote URI (e.g., using "file://" or "https://"). | |||
| https://$PROXY_HOST:$PROXY_PORT/.well-known/masque | https://$PROXY_HOST:$PROXY_PORT/.well-known/masque | |||
| /tcp/{target_host}/{target_port}/ | /tcp/{target_host}/{target_port}/ | |||
| Figure 2: Registered default template | Figure 2: Registered default template | |||
| All of these input types MAY share a single input string, as they can | All of these input types MAY share a single input string, as they can | |||
| be disambiguated reliably by parsing and probing. However, it may be | be disambiguated reliably by parsing and probing. However, it may be | |||
| preferable to indicate the configuration input type explicitly, to | preferable to indicate the configuration input type explicitly, to | |||
| reduce probing delays while supporting clients with differing | reduce probing delays while supporting clients with differing | |||
| capabilities. | capabilities. | |||
| Clients SHOULD treat certain errors during classic HTTP CONNECT as | Clients SHOULD treat certain errors during classic HTTP CONNECT as | |||
| indications that the proxy might only support "connect-tcp": | indications that the proxy might only support CONNECT-TCP: | |||
| o In HTTP/1.1: the response status code is "426 (Upgrade Required)", | o In HTTP/1.1: the response's status code is 426 (Upgrade Required), | |||
| with an "Upgrade: connect-tcp" response header. | with an "Upgrade: connect-tcp" response header. | |||
| o In any HTTP version: the response status code is "501 (Not | o In any HTTP version: the response's status code is 501 (Not | |||
| Implemented)". | Implemented). | |||
| * Requires SETTINGS_ENABLE_CONNECT_PROTOCOL to have been | * Requires SETTINGS_ENABLE_CONNECT_PROTOCOL to have been | |||
| negotiated in HTTP/2 or HTTP/3. | negotiated in HTTP/2 or HTTP/3. | |||
| If the client infers that classic HTTP CONNECT is not supported, it | If the client infers that classic HTTP CONNECT is not supported, it | |||
| SHOULD retry the request using the registered default template for | SHOULD retry the request using the registered default template for | |||
| "connect-tcp" (Figure 2). If this request succeeds, the client | "connect-tcp" (Figure 2). If this request succeeds, the client | |||
| SHOULD record a preference for "connect-tcp" to avoid further retry | SHOULD record a preference for CONNECT-TCP to avoid further retry | |||
| delays. | delays. | |||
| 5.3. Gateways | 5.3. Gateways | |||
| Templated TCP proxy requests can traverse standard HTTP gateways to | CONNECT-TCP requests can traverse standard HTTP gateways to ease | |||
| ease implementation and allow use of shared infrastructure. However, | implementation and allow use of shared infrastructure. However, | |||
| current gateways might need modifications to support TCP proxy | current gateways might need modifications to support TCP proxy | |||
| services. To be compatible, a gateway MUST: | services. To be compatible, a gateway MUST: | |||
| o support Extended CONNECT (if acting as an HTTP/2 or HTTP/3 | o support Extended CONNECT (if acting as an HTTP/2 or HTTP/3 | |||
| server). | server). | |||
| o support HTTP/1.1 Upgrade to "connect-tcp" (if acting as an | o support HTTP/1.1 Upgrade to "connect-tcp" (if acting as an | |||
| HTTP/1.1 server) | HTTP/1.1 server). | |||
| * only after forwarding the upgrade request to the origin and | * only after forwarding the upgrade request to the origin and | |||
| observing a success response. | observing a success response. | |||
| o forward the "connect-tcp" protocol to the origin. | o forward the "connect-tcp" protocol to the origin. | |||
| o convert "connect-tcp" requests between all supported HTTP server | o convert CONNECT-TCP requests between all supported HTTP server and | |||
| and client versions. | client versions. | |||
| o allow any "Proxy-Status" headers to traverse the gateway. | o allow any Proxy-Status headers to traverse the gateway. | |||
| If the proxy relies on TLS Client Certificates for client | If the proxy relies on TLS Client Certificates for client | |||
| authentication, the gateway MUST perform this authentication itself | authentication, the gateway MUST perform this authentication itself | |||
| or pass the relevant information to the origin (e.g., using a | or pass the relevant information to the origin (e.g., using a Client- | |||
| "Client-Cert" request header field [RFC9440]). | Cert request header field [RFC9440]). | |||
| 6. Security Considerations | 6. Security Considerations | |||
| Template-driven TCP proxying is largely subject to the same security | CONNECT-TCP is largely subject to the same security risks as classic | |||
| risks as classic HTTP CONNECT. For example, any restrictions on | HTTP CONNECT. For example, any restrictions on authorized use of the | |||
| authorized use of the proxy (see [HTTP], Section 9.3.6) apply equally | proxy (see [HTTP], Section 9.3.6) apply equally to both. The | |||
| to both. The "destination_ip_prohibited" Proxy Error Type from | "destination_ip_prohibited" Proxy Error Type from Section 2.3.5 of | |||
| Section 2.3.5 of [PROXY-STATUS] can be useful when rejecting | [PROXY-STATUS] can be useful when rejecting unauthorized requests. | |||
| unauthorized requests. | ||||
| A small additional risk is posed by the use of a URI Template parser | A small additional risk is posed by the use of a URI Template parser | |||
| on the client side. The template input string could be crafted to | on the client side. The template input string could be crafted to | |||
| exploit any vulnerabilities in the parser implementation. Client | exploit any vulnerabilities in the parser implementation. Client | |||
| implementers should apply their usual precautions for code that | implementers should apply their usual precautions for code that | |||
| processes untrusted inputs. | processes untrusted inputs. | |||
| See Section 7 of [CONNECT-UDP] for a comparison of the risks of | See Section 7 of [CONNECT-UDP] for a comparison of the risks of | |||
| operating a TCP or UDP proxy. | operating a TCP or UDP proxy. | |||
| skipping to change at page 17, line 14 ¶ | skipping to change at page 17, line 10 ¶ | |||
| + Limit the number of connections for each client to each | + Limit the number of connections for each client to each | |||
| destination, even if those connections are in a waiting | destination, even if those connections are in a waiting | |||
| state and the corresponding CONNECT stream is closed. | state and the corresponding CONNECT stream is closed. | |||
| + If necessary, perform an abrupt TCP closure that destroys | + If necessary, perform an abrupt TCP closure that destroys | |||
| the Transmission Control Block. Note that reusing a 4-tuple | the Transmission Control Block. Note that reusing a 4-tuple | |||
| in this way can increase the risk of interference between | in this way can increase the risk of interference between | |||
| successive connections. | successive connections. | |||
| 6.2. Client Authentication | ||||
| A proxy server operating without access controls on the open internet | ||||
| (an "open proxy") is likely to be discovered and misused quickly by | ||||
| attackers. HTTP client authentication is the most common way to | ||||
| avoid this misuse. | ||||
| Section 3.4.2 describes how to use HTTP client authentication with | ||||
| this specification. Each HTTP client authentication scheme offers | ||||
| distinct security properties, so care should be taken to select an | ||||
| appropriate scheme for each deployment. See [HTTP], Section 17.16 | ||||
| for additional guidance related to HTTP authentication. | ||||
| 6.3. TLS Early Data | ||||
| This specification supports sending both proxying requests and | ||||
| optimistic payload data in TLS early data (Section 4.1). TLS 1.3 | ||||
| recommends, but does not require, replay protection for this data | ||||
| ([TLS], Section 8), so a replay attack could cause the proxy service | ||||
| to establish multiple connections to the target, and to deliver any | ||||
| optimistic payload data on each of these connections. When such a | ||||
| replay attack would cause harm (e.g., when the optimistic data | ||||
| represents a non-idempotent application command), clients MUST NOT | ||||
| use TLS early data. | ||||
| See Section 6 of [RFC8470] for additional relevant security | ||||
| considerations. | ||||
| 7. Operational Considerations | 7. Operational Considerations | |||
| 7.1. Avoiding HTTP/1.1 | 7.1. Avoiding HTTP/1.1 | |||
| While this specification is fully functional under HTTP/1.1, | While this specification is fully functional under HTTP/1.1, | |||
| performance-sensitive deployments SHOULD use HTTP/2 or HTTP/3 | performance-sensitive deployments SHOULD use HTTP/2 or HTTP/3 | |||
| instead. When using HTTP/1.1: | instead. When using HTTP/1.1: | |||
| o Each CONNECT request requires a new TCP and TLS connection, | o Each CONNECT request requires a new TCP and TLS connection, | |||
| imposing a higher cost in setup latency, congestion control | imposing a higher cost in setup latency, congestion control | |||
| convergence, CPU time, and data transfer. | convergence, CPU time, and data transfer. | |||
| o The graceful and abrupt closure signals (Section 3.4) are more | o The graceful and abrupt closure signals (Section 3.5) are more | |||
| likely to be missing or corrupted: | likely to be missing or corrupted: | |||
| * Some implementations may be unable to emit the recommended | * Some implementations may be unable to emit the recommended | |||
| abrupt closure signals, due to limitations in their TCP and TLS | abrupt closure signals, due to limitations in their TCP and TLS | |||
| subsystems. | subsystems. | |||
| * Faulty implementations may fail to send a TLS closure alert | * Faulty implementations may fail to send a TLS closure alert | |||
| during graceful shutdown, or fail to report an error when the | during graceful shutdown, or fail to report an error when the | |||
| expected closure alert is not received. These misbehaviors are | expected closure alert is not received. These misbehaviors are | |||
| not compliant with [TLS], but they are common nonetheless among | not compliant with [TLS], but they are common nonetheless among | |||
| skipping to change at page 18, line 19 ¶ | skipping to change at page 18, line 44 ¶ | |||
| TCP are designed to ensure that such an event always arrives, so the | TCP are designed to ensure that such an event always arrives, so the | |||
| connection is never permanently stuck in any state until it is fully | connection is never permanently stuck in any state until it is fully | |||
| closed. However, for efficient operation, it may be necessary to | closed. However, for efficient operation, it may be necessary to | |||
| adjust the settings for TCP keep-alives ([TCP], Section 3.8.4), QUIC | adjust the settings for TCP keep-alives ([TCP], Section 3.8.4), QUIC | |||
| idle timeouts ([QUIC], Section 10.1), HTTP/2 PING frames ([RFC9113], | idle timeouts ([QUIC], Section 10.1), HTTP/2 PING frames ([RFC9113], | |||
| Section 6.7), and other transport options. | Section 6.7), and other transport options. | |||
| Endpoints MAY impose additional timeouts, especially as a defense | Endpoints MAY impose additional timeouts, especially as a defense | |||
| against certain resource exhaustion attacks (Section 6.1). However, | against certain resource exhaustion attacks (Section 6.1). However, | |||
| operators should apply timeouts cautiously to minimize the impact on | operators should apply timeouts cautiously to minimize the impact on | |||
| connections that are functioning but slow. See Section 3.4 for | connections that are functioning but slow. See Section 3.5 for | |||
| related requirements. | related requirements. | |||
| 7.3. IP address sharing | For example, enabling PING frames on idle HTTP/2 connections allows | |||
| the operator to prevent some kinds of failures and detect failed | ||||
| connections faster, but it uses more bandwidth, CPU time, and radio | ||||
| power, and increases the risk of false-positive connection failures. | ||||
| Optimal transport settings will depend on the network environment | ||||
| (e.g., mobile vs. fixed), characteristics of the tunneled | ||||
| application, and many other considerations. | ||||
| 7.3. Scope of Packet-Level Metadata | ||||
| This specification does not provide a way to pass packet-level | ||||
| metadata such as IPv6 Extension Headers [RFC2460], Section 4, | ||||
| DiffServ Codepoints (DSCP) [RFC2474], or Explicit Congestion | ||||
| Notification (ECN) marks [RFC3168] through the tunnel. TCP options | ||||
| and non-fatal ICMP messages (e.g., Packet Too Big) are similarly not | ||||
| relayed. Instead, these signals are processed by the relevant | ||||
| endpoint of this specification, which is also the TCP endpoint and | ||||
| only relays payload data through the tunnel. | ||||
| Consumption and generation of these signals on each connection is | ||||
| controlled by the endpoint, and is independent from any behaviors of | ||||
| the other endpoint and any similar signals on the tunnel's HTTP | ||||
| connection. If the operator has requirements related to these | ||||
| behaviors, it must configure the relevant endpoint (typically the | ||||
| proxy) accordingly. | ||||
| 7.4. IP address sharing | ||||
| A TCP proxy typically uses the same IP address to establish | A TCP proxy typically uses the same IP address to establish | |||
| connections on behalf of multiple clients, especially in IPv4. | connections on behalf of multiple clients, especially in IPv4. | |||
| [RFC6269] provides guidance regarding difficulties that can arise | [RFC6269] provides guidance regarding difficulties that can arise | |||
| from IP address sharing, including in this arrangement. | from IP address sharing, including in this arrangement. | |||
| 7.5. Diagnostics and Monitoring | ||||
| A proxy in this protocol reports success or failure in each response | ||||
| via the HTTP status code and the Proxy-Status response header field. | ||||
| Monitoring those error codes is a sensible way to assess the | ||||
| functioning of a proxy server. Other relevant performance indicators | ||||
| may include: | ||||
| o Abrupt closure rates | ||||
| o Number of active tunnels per user | ||||
| o Total throughput in each direction | ||||
| o Number of bytes buffered | ||||
| o Connection duration | ||||
| o Time spent establishing or closing connections | ||||
| o Number of half-closed or WAIT-state connections | ||||
| o DNS resolution delay | ||||
| An increase in any of these measures could indicate an operational | ||||
| problem or a resource exhaustion attack (Section 6.1). See | ||||
| Section 6.1 for guidance on relevant defenses and limits. | ||||
| 8. IANA Considerations | 8. IANA Considerations | |||
| 8.1. New Upgrade Token | 8.1. New Upgrade Token | |||
| IANA is requested to add the following entry to the "HTTP Upgrade | IANA is requested to add the following entry to the "HTTP Upgrade | |||
| Tokens" registry under "Hypertext Transfer Protocol (HTTP) Upgrade | Tokens" registry under "Hypertext Transfer Protocol (HTTP) Upgrade | |||
| Token Registry" registry group: | Token Registry" registry group: | |||
| +---------------+-------------------+-----------------+-------------+ | +---------------+-------------------+-----------------+-------------+ | |||
| | Value | Description | Expected | Reference | | | Value | Description | Expected | Reference | | |||
| skipping to change at page 21, line 49 ¶ | skipping to change at page 23, line 35 ¶ | |||
| [HEv2] Schinazi, D. and T. Pauly, "Happy Eyeballs Version 2: | [HEv2] Schinazi, D. and T. Pauly, "Happy Eyeballs Version 2: | |||
| Better Connectivity Using Concurrency", RFC 8305, | Better Connectivity Using Concurrency", RFC 8305, | |||
| DOI 10.17487/RFC8305, December 2017, | DOI 10.17487/RFC8305, December 2017, | |||
| <https://www.rfc-editor.org/info/rfc8305>. | <https://www.rfc-editor.org/info/rfc8305>. | |||
| [HSTS] Hodges, J., Jackson, C., and A. Barth, "HTTP Strict | [HSTS] Hodges, J., Jackson, C., and A. Barth, "HTTP Strict | |||
| Transport Security (HSTS)", RFC 6797, | Transport Security (HSTS)", RFC 6797, | |||
| DOI 10.17487/RFC6797, November 2012, | DOI 10.17487/RFC6797, November 2012, | |||
| <https://www.rfc-editor.org/info/rfc6797>. | <https://www.rfc-editor.org/info/rfc6797>. | |||
| [HTTP-CACHING] | ||||
| Fielding, R., Ed., Nottingham, M., Ed., and J. Reschke, | ||||
| Ed., "HTTP Caching", STD 98, RFC 9111, | ||||
| DOI 10.17487/RFC9111, June 2022, | ||||
| <https://www.rfc-editor.org/info/rfc9111>. | ||||
| [I-D.ietf-httpbis-wrap-up] | [I-D.ietf-httpbis-wrap-up] | |||
| Schinazi, D. and L. Pardue, "The HTTP Wrap Up Capsule", | Schinazi, D. and L. Pardue, "The HTTP Wrap Up Capsule", | |||
| draft-ietf-httpbis-wrap-up-01 (work in progress), July | draft-ietf-httpbis-wrap-up-01 (work in progress), July | |||
| 2025. | 2025. | |||
| [I-D.ietf-intarea-proxy-config] | [I-D.ietf-intarea-proxy-config] | |||
| Pauly, T., Damjanovic, D., and Y. Rosomakho, | Pauly, T., Damjanovic, D., and Y. Rosomakho, | |||
| "Communicating Proxy Configurations in Provisioning | "Communicating Proxy Configurations in Provisioning | |||
| Domains", draft-ietf-intarea-proxy-config-14 (work in | Domains", draft-ietf-intarea-proxy-config-14 (work in | |||
| progress), May 2026. | progress), May 2026. | |||
| [I-D.ietf-quic-reliable-stream-reset] | [I-D.ietf-quic-reliable-stream-reset] | |||
| Seemann, M. and K. Oku, "QUIC Stream Resets with Partial | Seemann, M. and K. Oku, "QUIC Stream Resets with Partial | |||
| Delivery", draft-ietf-quic-reliable-stream-reset-11 (work | Delivery", draft-ietf-quic-reliable-stream-reset-11 (work | |||
| in progress), September 2026. | in progress), September 2026. | |||
| [RFC2460] Deering, S. and R. Hinden, "Internet Protocol, Version 6 | ||||
| (IPv6) Specification", RFC 2460, DOI 10.17487/RFC2460, | ||||
| December 1998, <https://www.rfc-editor.org/info/rfc2460>. | ||||
| [RFC2474] Nichols, K., Blake, S., Baker, F., and D. Black, | ||||
| "Definition of the Differentiated Services Field (DS | ||||
| Field) in the IPv4 and IPv6 Headers", RFC 2474, | ||||
| DOI 10.17487/RFC2474, December 1998, | ||||
| <https://www.rfc-editor.org/info/rfc2474>. | ||||
| [RFC3168] Ramakrishnan, K., Floyd, S., and D. Black, "The Addition | ||||
| of Explicit Congestion Notification (ECN) to IP", | ||||
| RFC 3168, DOI 10.17487/RFC3168, September 2001, | ||||
| <https://www.rfc-editor.org/info/rfc3168>. | ||||
| [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, | [RFC6265] Barth, A., "HTTP State Management Mechanism", RFC 6265, | |||
| DOI 10.17487/RFC6265, April 2011, | DOI 10.17487/RFC6265, April 2011, | |||
| <https://www.rfc-editor.org/info/rfc6265>. | <https://www.rfc-editor.org/info/rfc6265>. | |||
| [RFC6269] Ford, M., Ed., Boucadair, M., Durand, A., Levis, P., and | [RFC6269] Ford, M., Ed., Boucadair, M., Durand, A., Levis, P., and | |||
| P. Roberts, "Issues with IP Address Sharing", RFC 6269, | P. Roberts, "Issues with IP Address Sharing", RFC 6269, | |||
| DOI 10.17487/RFC6269, June 2011, | DOI 10.17487/RFC6269, June 2011, | |||
| <https://www.rfc-editor.org/info/rfc6269>. | <https://www.rfc-editor.org/info/rfc6269>. | |||
| [RFC7323] Borman, D., Braden, B., Jacobson, V., and R. | [RFC7323] Borman, D., Braden, B., Jacobson, V., and R. | |||
| skipping to change at page 22, line 44 ¶ | skipping to change at page 25, line 7 ¶ | |||
| [RFC9440] Campbell, B. and M. Bishop, "Client-Cert HTTP Header | [RFC9440] Campbell, B. and M. Bishop, "Client-Cert HTTP Header | |||
| Field", RFC 9440, DOI 10.17487/RFC9440, July 2023, | Field", RFC 9440, DOI 10.17487/RFC9440, July 2023, | |||
| <https://www.rfc-editor.org/info/rfc9440>. | <https://www.rfc-editor.org/info/rfc9440>. | |||
| [SYSCTL] "IP Sysctl -- The Linux Kernel documentation", June 2026, | [SYSCTL] "IP Sysctl -- The Linux Kernel documentation", June 2026, | |||
| <https://www.kernel.org/doc/html/v7.1/networking/ip- | <https://www.kernel.org/doc/html/v7.1/networking/ip- | |||
| sysctl.html>. | sysctl.html>. | |||
| Acknowledgments | Acknowledgments | |||
| Thanks to Amos Jeffries, Tommy Pauly, Kyle Nekritz, David Schinazi, | This document benefited from close review and suggested changes by: | |||
| and Kazuho Oku for close review and suggested changes. | ||||
| o Mohamed Boucadair | ||||
| o Deb Cooley | ||||
| o Gorry Fairhurst | ||||
| o Thomas Fossati | ||||
| o Amos Jeffries | ||||
| o Mahesh Jethanandani | ||||
| o Antun Jurkovic | ||||
| o Eric Kinnear | ||||
| o Kyle Nekritz | ||||
| o Kazuho Oku | ||||
| o Tommy Pauly | ||||
| o Yaroslav Romakho | ||||
| o David Schinazi | ||||
| o Ketan Talaulikar | ||||
| o Willy Tarreau | ||||
| Author's Address | Author's Address | |||
| Benjamin M. Schwartz | Benjamin M. Schwartz | |||
| Meta Platforms, Inc. | Meta Platforms, Inc. | |||
| Email: ietf@bemasc.net | Email: ietf@bemasc.net | |||
| End of changes. 90 change blocks. | ||||
| 175 lines changed or deleted | 322 lines changed or added | |||
This html diff was produced by rfcdiff 1.48. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ | ||||