HTTP | M. Nottingham |
Internet-Draft | Fastly |
Intended status: Standards Track | P. Sikora |
Expires: September 2, 2020 | |
March 1, 2020 |
The Proxy-Status HTTP Response Header Field
draft-ietf-httpbis-proxy-status-01
This document defines the Proxy-Status HTTP header field to convey the details of intermediary handling of responses, 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 September 2, 2020.
Copyright (c) 2020 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 – 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 and then forward their responses back to clients. However, if an error occurs, the response is 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 header field to allow intermediaries to convey details of their handling of a response, and Section 2.2 defines a set of Proxy Error Types for use when a proxy generates the response. Section 2.3 explains how to define new Proxy Error Types.
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 Headers [I-D.ietf-httpbis-header-structure] to specify syntax. The terms sh-param-list, sh-item, sh-string, sh-token and sh-integer 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 header field allows an intermediary to convey additional information about its handling of a response and its associated request.
It is a Structured Headers [I-D.ietf-httpbis-header-structure] List of parameterised Tokens:
Cache-Status = sh-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:
Proxy-Status: FooProxy, ExampleCDN
indicates that this response was handled first by FooAccelerator and then ExampleCDN.
Parameters on each member convey additional information about that intermediary’s handling of the response; see Section 2.1 for defined parameters.
Intermediaries determine when it is appropriate to add the Proxy-Status header field to a response. Some might decide to add it to all responses, whereas others might only do so when specifically configured to, or when the request contains a header that activates a debugging mode.
When adding a value to the Proxy-Status header field, intermediaries SHOULD preserve the existing contents of the header, to allow debugging of the entire chain of intermediaries handling the request.
The list members identify the intermediary that inserted the value, and MUST have a type of either sh-string or sh-token. Depending on the deployment, this might be a product or service name (e.g., ExampleProxy or “Example CDN”), a hostname (“proxy-3.example.com”), and IP address, or a generated string.
Each member of the list can also have a number of parameters that describe that intermediary’s handling of the request. While all of these parameters are OPTIONAL, intermediaries are encouraged to provide as much information as possible.
Proxy-Status MAY be sent in HTTP trailers, but – as with all trailers – it might be silently discarded along the path to the user agent, so this SHOULD NOT be done unless it is not possible to send it in headers. For example, if an intermediary is streaming a response and the upstream connection suddenly terminates, Proxy-Status can be appended to the trailers of the outgoing message (since the headers have already been sent).
Note that there are various security considerations for intermediaries using the Proxy-Status header field; see Section 4.
Origin servers MUST NOT generate the Proxy-Status header field.
This section lists parameters that can be used on the members of Proxy-Status.
The origin parameter’s value is a sh-string or sh-token that identifies the origin server selected (and used, if contacted) for this response. Its contents might be a hostname, IP address, or alias.
This is most useful for gateways (also known as “reverse proxies”), since they are often configured to use an origin server other than that which appears in the URL, and sometimes they use several origins to serve a given site.
For example:
Proxy-Status: cdn.example.org; origin=backend.example.org
The fwd-protocol parameter’s value is a sh-token indicating the ALPN protocol identifier [RFC7301] used by the intermediary to connect to the next hop. This is only applicable when that connection was actually established.
For example:
Proxy-Status: "proxy.example.org"; fwd-protocol=h2
The error parameter’s value is a sh-token that is a Proxy Error Type. When present, it indicates that the response was generated by the proxy, not the origin server or any other upstream server.
Section 2.2 lists the Proxy Error Types defined in this document; new ones can be defined using the procedure outlined in Section 2.3.
For example:
HTTP/1.1 504 Gateway Timeout Proxy-Status: SomeCDN; error=connection_timeout
indicates that this 504 response was generated by SomeCDN, due to a connection timeout when going forward.
Or:
HTTP/1.1 429 Too Many Requests Proxy-Status: SomeReverseProxy; error=http_request_error
indicates that this 429 Too Many Requests response was generated by the intermediary, not the origin.
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) when another status code might be used.
The details parameter’s value is a sh-string containing additional information not captured anywhere else. This can include implementation-specific or deployment-specific information.
For example:
Proxy-Status: ExampleProxy; error="http_protocol_error"; details="Malformed response header - space before colon"
This section lists the Proxy Error Types defined by this document. See Section 2.3 for information about defining new Proxy Error Types.
This type helps distinguish between responses generated by intermediaries from those generated by the origin.
New Proxy Error Types can be defined by registering them in the HTTP Proxy Error Types registry.
Registration requests are reviewed and approved by a Designated Expert, 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-statuses for details on where to send registration requests.
Upon publication, please create the HTTP Proxy Error Types registry at https://iana.org/assignments/http-proxy-statuses and populate it with the types defined in Section 2.2; see Section 2.3 for its associated procedures.
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.
As a result, care needs to be taken when deciding to generate a Proxy-Status header. Note that intermediaries are not required to generate a Proxy-Status header 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.
[I-D.ietf-httpbis-header-structure] | Nottingham, M. and P. Kamp, "Structured Headers for HTTP", Internet-Draft draft-ietf-httpbis-header-structure-13, August 2019. |
[RFC2119] | Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997. |
[RFC7301] | Friedl, S., Popov, A., Langley, A. and E. Stephan, "Transport Layer Security (TLS) Application-Layer Protocol Negotiation Extension", RFC 7301, DOI 10.17487/RFC7301, July 2014. |
[RFC8126] | Cotton, M., Leiba, B. and T. Narten, "Guidelines for Writing an IANA Considerations Section in RFCs", BCP 26, RFC 8126, DOI 10.17487/RFC8126, June 2017. |
[RFC8174] | Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017. |
[RFC8499] | Hoffman, P., Sullivan, A. and K. Fujiwara, "DNS Terminology", BCP 219, RFC 8499, DOI 10.17487/RFC8499, January 2019. |
[RFC8586] | Ludin, S., Nottingham, M. and N. Sullivan, "Loop Detection in Content Delivery Networks (CDNs)", RFC 8586, DOI 10.17487/RFC8586, April 2019. |