The Proxy-Status HTTP Response Header Field
Fastly
Prahran
VIC
Australia
mnot@mnot.net
https://www.mnot.net/
Google
piotrsikora@google.com
Applications and Real-Time
HTTP
Internet-Draft
This document defines the Proxy-Status HTTP field to convey the details of intermediary response handling, including generated errors.
Note to Readers
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.
Introduction
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 before a response is obtained from upstream, 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, defines a new HTTP response field to allow intermediaries to convey details of their handling of a response, enumerates the kind of information that can be conveyed, and defines a set of error types for use when a proxy encounters an issue when obtaining a response for the request.
Notational Conventions
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 when, and only when, they appear in all capitals, as shown here.
This specification uses Structured Fields to specify syntax and parsing. 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 Field
The Proxy-Status HTTP response field allows an intermediary to convey additional information about its handling of a response and its associated request.
It is a 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 FooProxy 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 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 product or service name (e.g., ExampleProxy or "Example CDN"), a hostname ("proxy-3.example.com"), an IP address, or a generated string.
Parameters on each member convey additional information about that intermediary's handling of the response and its associated request; see . While all of these parameters are OPTIONAL, intermediaries are encouraged to provide as much information as possible (but see 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.
Proxy-Status MAY be sent in HTTP trailers. For example, if an intermediary is streaming a response and the upstream connection suddenly terminates, Proxy-Status can only be appended to the trailers of the outgoing message, since the headers have already been sent. 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, and an intermediary MUST NOT send Proxy-Status as a trailer field unless it has also sent a corresponding Proxy-Status header field in the same message, so that the trailer value's ordering relative to other intermediaries is preserved.
Origin servers MUST NOT generate the Proxy-Status field.
Proxy-Status Parameters
This section lists parameters that can be used on the members of the Proxy-Status field. Unrecognised parameters SHOULD be ignored.
error
The error parameter's value is an sf-token that is a Proxy Error Type. When present, it indicates that the proxy encountered an issue when obtaining a response.
Unless a Proxy Error Type specifies otherwise, the presences of error often, but not always, indicates that response was generated by the proxy, not the origin server or any other upstream server. For example, a proxy might attempt to correct an error, or part of a response might be forwarded before the error is encountered.
lists the Proxy Error Types defined in this document; new ones can be defined using the procedure outlined in .
For example:
indicates that this 504 response was generated by SomeCDN, due to a connection timeout when going forward.
Or:
indicates that this 429 Too Many Requests response was generated by the intermediary, not 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 ).
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.
next-hop
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) for this response. It might be a hostname, IP address, or alias.
For example:
next-protocol
The next-protocol parameter's value indicates the ALPN protocol identifier used by the intermediary to connect to the next hop. This is only applicable when that connection was actually established.
The value MUST be either an sf-token or sf-binary. If the protocol identifier is able to be expressed as an sf-token using UTF-8 encoding, that form MUST be used.
For example:
received-status
The received-status parameter's value indicates the HTTP status code that the intermediary received from the next hop server.
The value MUST be an sf-integer.
For example:
details
The details parameter's value is an sf-string containing additional information not captured anywhere else. This can include implementation-specific or deployment-specific information.
For example:
Defining New Proxy-Status Parameters
New Proxy-Status Parameters can be defined by registering them in the HTTP Proxy-Status Parameters registry.
Registration requests are reviewed and approved by a Designated Expert, as per . A specification document is appreciated, but not required.
The Expert(s) should consider the following factors when evaluating requests:
- Community feedback
- If the value is sufficiently well-defined
- Generic parameters are preferred over vendor-specific, application-specific or deployment-specific values. If a generic value cannot be agreed upon in the community, the parameter's name should be correspondingly specific (e.g., with a prefix that identifies the vendor, application or deployment).
- Parameter names should not conflict with registered extra parameters in the Proxy Error Type Registry.
Registration requests should use the following template:
- Name: [a name for the Proxy-Status Parameter that matches key]
- Description: [a description of the parameter semantics and value]
- Reference: [to a specification defining this parameter]
See the registry at https://iana.org/assignments/http-proxy-status for details on where to send registration requests.
Proxy Error Types
This section lists the Proxy Error Types defined by this document. See for information about defining new Proxy Error Types.
DNS Timeout
- Name: dns_timeout
- Description: The intermediary encountered a timeout when trying to find an IP address for the next hop hostname.
- Extra Parameters: None.
- Recommended HTTP status code: 504
DNS Error
- Name: dns_error
- Description: The intermediary encountered a DNS error when trying to find an IP address for the next hop hostname.
-
Extra Parameters:
- rcode: A sf-string conveying the DNS RCODE that indicates the error type. See .
- Recommended HTTP status code: 502
Destination Not Found
- Name: destination_not_found
- Description: The intermediary cannot determine the appropriate next hop to use for this request; for example, it may not be configured. Note that this error is specific to gateways, which typically require specific configuration to identify the "backend" server; forward proxies use in-band information to identify the origin server.
- Extra Parameters: None.
- Recommended HTTP status code: 500
Destination Unavailable
- Name: destination_unavailable
- Description: The intermediary considers the next hop to be unavailable; e.g., recent attempts to communicate with it may have failed, or a health check may indicate that it is down.
- Extra Parameters: None.
- Recommended HTTP status code: 503
Destination IP Prohibited
- Name: destination_ip_prohibited
- Description: The intermediary is configured to prohibit connections to the next hop IP address.
- Extra Parameters: None.
- Recommended HTTP status code: 502
Destination IP Unroutable
- Name: destination_ip_unroutable
- Description: The intermediary cannot find a route to the next hop IP address.
- Extra Parameters: None.
- Recommended HTTP status code: 502
Connection Refused
- Name: connection_refused
- Description: The intermediary's connection to the next hop was refused.
- Extra Parameters: None.
- Recommended HTTP status code: 502
Connection Terminated
- Name: connection_terminated
- Description: The intermediary's connection to the next hop was closed before complete response was received.
- Extra Parameters: None.
- Recommended HTTP status code: 502
- Notes: Responses with this error type might not have been generated by the intermediary.
Connection Timeout
- Name: connection_timeout
- Description: The intermediary's attempt to open a connection to the next hop timed out.
- Extra Parameters: None.
- Recommended HTTP status code: 504
Connection Read Timeout
- Name: connection_read_timeout
- Description: The intermediary was expecting data on a connection (e.g., part of a response), but did not receive any new data in a configured time limit.
- Extra Parameters: None.
- Recommended HTTP status code: 504
- Notes: Responses with this error type might not have been generated by the intermediary.
Connection Write Timeout
- Name: connection_write_timeout
- Description: The intermediary was attempting to write data to a connection, but was not able to (e.g., because its buffers were full).
- Extra Parameters: None.
- Recommended HTTP status code: 504
- Notes: Responses with this error type might not have been generated by the intermediary.
Connection Limit Reached
- Name: connection_limit_reached
- Description: The intermediary is configured to limit the number of connections it has to the next hop, and that limit has been passed.
- Extra Parameters: None.
- Recommended HTTP status code: 503
TLS Protocol Error
- Name: tls_protocol_error
- Description: The intermediary encountered a TLS error when communicating with the next hop, either during handshake or afterwards.
- Extra Parameters: None.
- Recommended HTTP status code: 502
- Notes: Responses with this error type might not have been generated by the intermediary.
Note that additional information about the error can be recorded in the details parameter (as is the case for all errors).
TLS Certificate Error
- Name: tls_certificate_error
- Description: The intermediary encountered an error when verifying the certificate presented by the next hop.
- Extra Parameters: None.
- Recommended HTTP status code: 502
Note that additional information about the error can be recorded in the details parameter (as is the case for all errors).
TLS Alert Received
- Name: tls_alert_received
- Description: The intermediary received a TLS alert from the next hop.
-
Extra Parameters:
- alert-message: an sf-token containing the applicable description string from the TLS Alerts registry.
- Recommended HTTP status code: 502
- Notes: Responses with this error type might not have been generated by the intermediary.
HTTP Request Error
- Name: http_request_error
- Description: The intermediary is generating a client (4xx) response on the origin's behalf. Applicable status codes include (but are not limited to) 400, 403, 405, 406, 408, 411, 413, 414, 415, 416, 417, 429.
-
Extra Parameters:
- status-code: an sf-integer containing the generated status code.
- status-phrase: an sf-string containing the generated status phrase.
- Recommended HTTP status code: The applicable 4xx status code
- Notes: This type helps distinguish between responses generated by intermediaries from those generated by the origin.
HTTP Request Denied
- Name: http_request_denied
- Description: The intermediary rejected the HTTP request based on its configuration and/or policy settings. The request wasn't forwarded to the next hop.
- Extra Parameters: None.
- Recommended HTTP status code: 403
HTTP Incomplete Response
- Name: http_response_incomplete
- Description: The intermediary received an incomplete response to the request from the next hop.
- Extra Parameters: None.
- Recommended HTTP status code: 502
- Notes: Responses with this error type might not have been generated by the intermediary.
HTTP Response Header Section Too Large
- Name: http_response_header_section_size
- Description: The intermediary received a response to the request whose header section was considered too large.
-
Extra Parameters:
- header-section-size: an sf-integer indicating how large the headers received were. Note that they might not be complete; i.e., the intermediary may have discarded or refused additional data.
- Recommended HTTP status code: 502
- Notes: Responses with this error type might not have been generated by the intermediary.
HTTP Response Header Too Large
- Name: http_response_header_size
- Description: The intermediary received a response to the request containing an individual header line that was considered too large.
-
Extra Parameters:
- header-name: an sf-string indicating the name of the header that triggered the error.
- header-size: an sf-integer indicating the size of the header that triggered the error.
- Recommended HTTP status code: 502
- Notes: Responses with this error type might not have been generated by the intermediary.
HTTP Response Body Too Large
- Name: http_response_body_size
- Description: The intermediary received a response to the request whose body was considered too large.
-
Extra Parameters:
- body-size: an sf-integer indicating how large the body received was. Note that it may not have been complete; i.e., the intermediary may have discarded or refused additional data.
- Recommended HTTP status code: 502
- Notes: Responses with this error type might not have been generated by the intermediary.
HTTP Response Trailer Section Too Large
- Name: http_response_trailer_section_size
- Description: The intermediary received a response to the request whose trailer section was considered too large.
-
Extra Parameters:
- trailer-section-size: an sf-integer indicating how large the trailers received were. Note that they might not be complete; i.e., the intermediary may have discarded or refused additional data.
- Recommended HTTP status code: 502
- Notes: Responses with this error type might not have been generated by the intermediary.
HTTP Response Trailer Too Large
- Name: http_response_trailer_size
- Description: The intermediary received a response to the request containing an individual trailer line that was considered too large.
-
Extra Parameters:
- trailer-name: an sf-string indicating the name of the trailer that triggered the error.
- trailer-size: an sf-integer indicating the size of the trailer that triggered the error.
- Recommended HTTP status code: 502
- Notes: Responses with this error type might not have been generated by the intermediary.
HTTP Response Transfer-Coding Error
- Name: http_response_transfer_coding
- Description: The intermediary encountered an error decoding the transfer-coding of the response.
-
Extra Parameters:
- coding: an sf-token containing the specific coding that caused the error.
- Recommended HTTP status code: 502
- Notes: Responses with this error type might not have been generated by the intermediary.
HTTP Response Content-Coding Error
- Name: http_response_content_coding
- Description: The intermediary encountered an error decoding the content-coding of the response.
-
Extra Parameters:
- coding: an sf-token containing the specific coding that caused the error.
- Recommended HTTP status code: 502
- Notes: Responses with this error type might not have been generated by the intermediary.
HTTP Response Timeout
- Name: http_response_timeout
- Description: The intermediary reached a configured time limit waiting for the complete response.
- Extra Parameters: None.
- Recommended HTTP status code: 504
- Notes: Responses with this error type might not have been generated by the intermediary.
HTTP Upgrade Failed
- Name: http_upgrade_failed
- Description: The HTTP Upgrade between the intermediary and the next hop failed.
- Extra Parameters: None.
- Recommended HTTP status code: 502
HTTP Protocol Error
- Name: http_protocol_error
- Description: The intermediary encountered a HTTP protocol error when communicating with the next hop. This error should only be used when a more specific one is not defined.
- Extra Parameters: None.
- Recommended HTTP status code: 502
- Notes: Responses with this error type might not have been generated by the intermediary.
Note that additional information about the error can be recorded in the details parameter (as is the case for all errors).
Proxy Internal Response
- Name: proxy_internal_response
- Description: The intermediary generated the response locally, without attempting to connect to the next hop (e.g. in response to a request to a debug endpoint terminated at the intermediary).
- Extra Parameters: None.
- Recommended HTTP status code:
Proxy Internal Error
- Name: proxy_internal_error
- Description: The intermediary encountered an internal error unrelated to the origin.
- Extra Parameters: None
- Recommended HTTP status code: 500
Note that additional information about the error can be recorded in the details parameter (as is the case for all errors).
Proxy Configuration Error
- Name: proxy_configuration_error
- Description: The intermediary encountered an error regarding its configuration.
- Extra Parameters: None
- Recommended HTTP status code: 500
Note that additional information about the error can be recorded in the details parameter (as is the case for all errors).
Proxy Loop Detected
- Name: proxy_loop_detected
- Description: The intermediary tried to forward the request to itself, or a loop has been detected using different means (e.g. ).
- Extra Parameters: None.
- Recommended HTTP status code: 502
Defining New Proxy Error Types
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 . A specification document is appreciated, but not required.
The Expert(s) should consider the following factors when evaluating requests:
- Community feedback
- If the value is sufficiently well-defined
- Generic types are preferred over vendor-specific, application-specific or deployment-specific values. If a generic value cannot be agreed upon in the community, the types's name should be correspondingly specific (e.g., with a prefix that identifies the vendor, application or deployment).
- Extra Parameters should not conflict with registered Proxy-Status parameters.
Registration requests should use the following template:
- Name: [a name for the Proxy Error Type that matches sf-token]
- Description: [a description of the conditions that generate the Proxy Error Type]
- Extra Parameters: [zero or more optional parameters, along with their allowable type(s)]
- Recommended HTTP status code: [the appropriate HTTP status code for this entry]
- Notes: [optional]
If the Proxy Error Type might occur in responses that are not generated by the intermediary -- for example, when the error is detected during response content processing and a Proxy-Status trailer field is appended -- that SHOULD be explained in the Notes.
See the registry at https://iana.org/assignments/http-proxy-status for details on where to send registration requests.
IANA Considerations
Upon publication, please create the HTTP Proxy-Status Parameters registry and the HTTP Proxy Error Types registry at https://iana.org/assignments/http-proxy-statuses and populate them with the types defined in and respectively; see and for its associated procedures.
Security Considerations
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 field. 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.
References
Normative References
Key words for use in RFCs to Indicate Requirement Levels
In many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.
Guidelines for Writing an IANA Considerations Section in RFCs
Many protocols make use of points of extensibility that use constants to identify various protocol parameters. To ensure that the values in these fields do not have conflicting uses and to promote interoperability, their allocations are often coordinated by a central record keeper. For IETF protocols, that role is filled by the Internet Assigned Numbers Authority (IANA).
To make assignments in a given registry prudently, guidance describing the conditions under which new values should be assigned, as well as when and how modifications to existing values can be made, is needed. This document defines a framework for the documentation of these guidelines by specification authors, in order to assure that the provided guidance for the IANA Considerations is clear and addresses the various issues that are likely in the operation of a registry.
This is the third edition of this document; it obsoletes RFC 5226.
DNS Terminology
The Domain Name System (DNS) is defined in literally dozens of different RFCs. The terminology used by implementers and developers of DNS protocols, and by operators of DNS systems, has sometimes changed in the decades since the DNS was first defined. This document gives current definitions for many of the terms used in the DNS in a single document.
This document obsoletes RFC 7719 and updates RFC 2308.
Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words
RFC 2119 specifies common key words that may be used in protocol specifications. This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.
Structured Field Values for HTTP
This document describes a set of data types and associated algorithms that are intended to make it easier and safer to define and handle HTTP header and trailer fields, known as "Structured Fields", "Structured Headers", or "Structured Trailers". It is intended for use by specifications of new HTTP fields that wish to use a common syntax that is more restrictive than traditional HTTP field values.
Transport Layer Security (TLS) Application-Layer Protocol Negotiation Extension
This document describes a Transport Layer Security (TLS) extension for application-layer protocol negotiation within the TLS handshake. For instances in which multiple application protocols are supported on the same TCP or UDP port, this extension allows the application layer to negotiate which protocol will be used within the TLS connection.
Informative References
Loop Detection in Content Delivery Networks (CDNs)
This document defines the CDN-Loop request header field for HTTP. CDN-Loop addresses an operational need that occurs when an HTTP request is intentionally forwarded between Content Delivery Networks (CDNs), but is then accidentally or maliciously re-routed back into the original CDN causing a non-terminating loop. The new header field can be used to identify the error and terminate the loop.