Internet-Draft | Proxy-Status Header | October 2021 |
Nottingham & Sikora | Expires 16 April 2022 | [Page] |
This document defines the Proxy-Status HTTP field to convey the details of intermediary response handling, including generated errors.¶
RFC EDITOR: please remove this section before publication¶
Discussion of this draft takes place on the HTTP working group mailing list (ietf-http-wg@w3.org), which is archived at https://lists.w3.org/Archives/Public/ietf-http-wg/.¶
Working Group information can be found at https://httpwg.org/; source code and issues list for this draft can be found at https://github.com/httpwg/http-extensions/labels/proxy-status.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on 16 April 2022.¶
Copyright (c) 2021 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://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.¶
HTTP intermediaries (see Section 3.7 of [HTTP]) -- including both forward proxies and gateways (also known as "reverse proxies") -- have become an increasingly significant part of HTTP deployments. In particular, reverse proxies and Content Delivery Networks (CDNs) form part of the critical infrastructure of many Web sites.¶
Typically, HTTP intermediaries forward requests towards the origin server (inbound) and then forward their responses back to clients (outbound). However, if an error occurs before a response is obtained from an inbound server, the response is often generated by the intermediary itself.¶
HTTP accommodates these types of errors with a few status codes; for example, 502 Bad Gateway and 504 Gateway Timeout. However, experience has shown that more information is necessary to aid debugging and communicate what's happened to the client. Additionally, intermediaries sometimes want to convey additional information about their handling of a response, even if they did not generate it.¶
To enable these uses, Section 2 defines a new HTTP response field to allow intermediaries to convey details of their handling of a response. Section 2.1 enumerates the information that can be added to the field by intermediaries, which can be extended as per Section 2.2. Section 2.3 defines a set of error types for use when a proxy encounters an issue when obtaining a response for the request; these can likewise be extended as per Section 2.4.¶
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.¶
This specification uses Structured Fields [STRUCTURED-FIELDS] to specify syntax and parsing, and ABNF [RFC5234] as a shorthand for that syntax. The terms sf-list, sf-item, sf-string, sf-token, sf-integer and key refer to the structured types defined therein.¶
Note that in this specification, "proxy" is used to indicate both forward and reverse proxies, otherwise known as gateways. "Next hop" indicates the connection in the direction leading to the origin server for the request.¶
The Proxy-Status HTTP response field allows an intermediary to convey additional information about its handling of a response and its associated request. The syntax of this header field conforms to [STRUCTURED-FIELDS].¶
It is a List ([STRUCTURED-FIELDS], Section 3.1):¶
Proxy-Status = sf-list¶
Each member of the list represents an intermediary that has handled the response. The first member of the list represents the intermediary closest to the origin server, and the last member of the list represents the intermediary closest to the user agent.¶
For example:¶
indicates that this response was handled first by revproxy1.example.net (a reverse proxy adjacent to the origin server) and then ExampleCDN.¶
Intermediaries determine when it is appropriate to add the Proxy-Status field to a response. Some might decide to append to it to all responses, whereas others might only do so when specifically configured to, or when the request contains a header field that activates a debugging mode.¶
Each member of the list identifies the intermediary that inserted the value, and MUST have a type of either sf-string or sf-token. Depending on the deployment, this might be a service name (but not a software or hardware product name; e.g., "Example CDN"is appropriate, but "ExampleProxy" is not, because it doesn't identify the deployment), a hostname ("proxy-3.example.com"), an IP address, or a generated string.¶
Parameters on each member (as per Section 3.1.2 of [STRUCTURED-FIELDS]) convey additional information about that intermediary's handling of the response and its associated request; see Section 2.1. While all of these parameters are OPTIONAL, intermediaries are encouraged to provide as much information as possible (but see Section 4 for security considerations in doing so).¶
When adding a value to the Proxy-Status field, intermediaries SHOULD preserve the existing members of the field to allow debugging of the entire chain of intermediaries handling the request, unless explicitly configured to remove them (e.g., to prevent internal network details from leaking; see Section 4).¶
Origin servers MUST NOT generate the Proxy-Status field.¶
Proxy-Status MAY be sent as a HTTP trailer field. For example, if an intermediary is streaming a response and the inbound connection suddenly terminates, Proxy-Status can only be appended to the trailer section of the outbound message, since the header section has already been sent. However, because it might be silently discarded along the path to the user agent (as is the case for all trailer fields; see Section 6.5 of [HTTP]), Proxy-Status SHOULD NOT be sent as a trailer field unless it is not possible to send it in the header section.¶
To allow recipients to reconstruct the relative ordering of Proxy-Status members conveyed in trailer fields with those conveyed in header fields, an intermediary MUST NOT send Proxy-Status as a trailer field unless it has also generated a Proxy-Status header field with the same member (although potentially different parameters) in that message.¶
For example, a proxy identified as 'ThisProxy' that receives a response bearing a header field:¶
would add its own entry to the header field:¶
thus allowing it to append a trailer field:¶
... which would thereby allow a downstream recipient to understand that processing by 'SomeOtherProxy' occurred before 'ThisProxy'.¶
A client MAY promote the Proxy-Status trailer field into a header field by following these steps:¶
For each member trailer_member of the Proxy-Status trailer field value:¶
This section lists parameters that can be used on the members of the Proxy-Status field. Unrecognised parameters MUST be ignored.¶
The error
parameter's value is an sf-token that is a Proxy Error Type. When present, it indicates that the intermediary encountered an issue when obtaining this response.¶
The presence of some Proxy Error Types indicates that the response was generated by the intermediary itself, rather than being forwarded from the origin server. This is the case when, for example, the origin server can't be contacted, so the proxy has to create its own response.¶
Other Proxy Error Types can be added to (potentially partial) responses that were generated by the origin server or some other inbound server. For example, if the forward connection abruptly closes, an intermediary might add Proxy-Status with an appropriate error as a trailer field.¶
Proxy Error Types that are registered with a 'Response only generated by intermediaries' value of 'true' indicate that they can only occur on responses generated by the intermediary. If the value is 'false', the response might be generated by the intermediary or an inbound server.¶
Section 2.3 lists the Proxy Error Types defined in this document; new ones can be defined using the procedure outlined in Section 2.4.¶
For example:¶
indicates that this 504 response was generated by ExampleCDN, due to a connection timeout when going forward.¶
Or:¶
indicates that this 429 Too Many Requests response was generated by r34.example.net, not the CDN or the origin.¶
When sending the error parameter, the most specific Proxy Error Type SHOULD be sent, provided that it accurately represents the error condition. If an appropriate Proxy Error Type is not defined, there are a number of generic error types (e.g., proxy_internal_error, http_protocol_error) that can be used. If they are not suitable, consider registering a new Proxy Error Type (see Section 2.4).¶
Each Proxy Error Type has a Recommended HTTP Status Code. When generating a HTTP response containing error
, its HTTP status code SHOULD be set to the Recommended HTTP Status Code. However, there may be circumstances (e.g., for backwards compatibility with previous behaviours, a status code has already been sent) when another status code might be used.¶
Proxy Error Types can also define any number of extra parameters for use with that type. Their use, like all parameters, is optional. As a result, if an extra parameter is used with a Proxy Error Type for which it is not defined, it will be ignored.¶
The next-hop
parameter's value is an sf-string or sf-token that identifies the intermediary or origin server selected (and used, if contacted) to obtain this response. It might be a hostname, IP address, or alias.¶
For example:¶
indicates that cdn.example.org used backend.example.org:8001 as the next hop for this request.¶
The next-protocol
parameter's value indicates the ALPN protocol identifier [RFC7301] of the protocol used by the intermediary to connect to the next hop when obtaining this response.¶
The value MUST be either an sf-token or sf-binary, representing a TLS Application-Layer Protocol Negotiation (ALPN) Protocol ID (see https://www.iana.org/assignments/tls-extensiontype-values/tls-extensiontype-values.xhtml#alpn-protocol-ids). If the protocol identifier is able to be expressed as an sf-token using ASCII encoding, that form MUST be used.¶
For example:¶
Note that the APLN identifier is being used here to identify the protocol in use; it may or may not have been actually used in the protocol negotiation.¶
The received-status
parameter's value indicates the HTTP status code that the intermediary received from the next hop server when obtaining this response.¶
The value MUST be an sf-integer.¶
For example:¶
New Proxy-Status Parameters can be defined by registering them in the HTTP Proxy-Status Parameters registry.¶
Registration requests are reviewed and approved by Expert Review, as per [RFC8126], Section 4.5. A specification document is appreciated, but not required.¶
The Expert(s) should consider the following factors when evaluating requests:¶
Registration requests should use the following template:¶
See the registry at https://iana.org/assignments/http-proxy-status for details on where to send registration requests.¶
This section lists the Proxy Error Types defined by this document. See Section 2.4 for information about defining new Proxy Error Types.¶
Note that implementations might not produce all Proxy Error Types. The set of types below is designed to map to existing states in implementations, and so may not be applicable to some.¶
Extra Parameters:¶
Extra Parameters:¶
Extra Parameters:¶
Extra Parameters:¶
Extra Parameters:¶
Extra Parameters:¶
Extra Parameters:¶
Extra Parameters:¶
New Proxy Error Types can be defined by registering them in the HTTP Proxy Error Types registry.¶
Registration requests are reviewed and approved by Expert Review, as per [RFC8126], Section 4.5. A specification document is appreciated, but not required.¶
The Expert(s) should consider the following factors when evaluating requests:¶
Registration requests should use the following template:¶
If the Proxy Error Type might occur in responses that are not generated by the intermediary -- for example, when an error is detected as the response is streamed from a forward connection, causing a Proxy-Status trailer field to be appended -- the 'Response only generated by intermediaries' should be 'false'. If the Proxy Error Type only occurs in responses that are generated by the intermediary, it should be 'true'.¶
See the registry at https://iana.org/assignments/http-proxy-status for details on where to send registration requests.¶
Upon publication, please create the HTTP Proxy-Status Parameters registry and the HTTP Proxy Error Types registry at https://iana.org/assignments/http-proxy-status and populate them with the types defined in Section 2.1 and Section 2.3 respectively; see Section 2.2 and Section 2.4 for its associated procedures.¶
Additionally, please register the following entry in the Hypertext Transfer Protocol (HTTP) Field Name Registry:¶
One of the primary security concerns when using Proxy-Status is leaking information that might aid an attacker. For example, information about the intermediary's configuration and back-end topology can be exposed, allowing attackers to directly target back-end services that are not prepared for high traffic volume or malformed inputs. Some information might only be suitable to reveal to authorized parties.¶
As a result, care needs to be taken when deciding to generate a Proxy-Status field and what information to include in it. Note that intermediaries are not required to generate a Proxy-Status field in any response, and can conditionally generate them based upon request attributes (e.g., authentication tokens, IP address).¶
Likewise, generation of all parameters is optional, as is generation of the field itself. Also, the field's content is not verified; an intermediary can claim certain actions (e.g., sending a request over an encrypted channel) but fail to actually do that.¶