<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>

<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-ietf-httpbis-proxy-status-08" number="9209" obsoletes="" updates="" submissionType="IETF" category="std" consensus="true" xml:lang="en" tocInclude="true" sortRefs="true" symRefs="true" version="3">

  <front>
    <title abbrev="Proxy-Status Header">The Proxy-Status HTTP Response Header Field</title>
    <seriesInfo name="RFC" value="9209"/>
    <author initials="M." surname="Nottingham" fullname="Mark Nottingham">
      <organization>Fastly</organization>
      <address>
        <postal>
          <postalLine>Prahran</postalLine>
          <postalLine>Australia</postalLine>
        </postal>
        <email>mnot@mnot.net</email>
        <uri>https://www.mnot.net/</uri>
      </address>
    </author>
    <author initials="P." surname="Sikora" fullname="Piotr Sikora">
      <organization>Google</organization>
      <address>
        <email>piotrsikora@google.com</email>
      </address>
    </author>
    <date year="2022" month="June" />
    <area>Applications and Real-Time</area>
    <workgroup>HTTP</workgroup>
    <keyword>proxy</keyword>
    <keyword>intermediary</keyword>
    <keyword>reverse proxy</keyword>
    <abstract>
      <t>This document defines the Proxy-Status HTTP response field to convey the details of an intermediary's response handling, including generated errors.</t>
    </abstract>
  </front>
  <middle>
    <section anchor="introduction" numbered="true" toc="default">
      <name>Introduction</name>
      <t>HTTP intermediaries (see <xref section="3.7" sectionFormat="of" target="HTTP" format="default"/>) -- 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 websites.</t>
      <t>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.</t>
      <t>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.</t>
      <t>To enable these uses, <xref target="header" format="default"/> defines a new HTTP response field to allow intermediaries to convey details of their handling of a response. <xref target="params" format="default"/> enumerates the information that can be added to the field by intermediaries, which can be extended per <xref target="register-param" format="default"/>. <xref target="error-types" format="default"/> 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 per <xref target="register-error" format="default"/>.</t>
      <section anchor="notational-conventions" numbered="true" toc="default">
        <name>Notational Conventions</name>
	        <t>
    The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
    NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
    "<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" in this document are to be interpreted as
    described in BCP&nbsp;14 <xref target="RFC2119"/> <xref target="RFC8174"/> 
    when, and only when, they appear in all capitals, as shown here.
        </t>
        <t>This document uses the following terminology from <xref target="STRUCTURED-FIELDS" section="3" sectionFormat="of" format="default"/> to specify syntax and parsing: List, String, Token, Integer, and Byte Sequence.</t>
        <t>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.</t>
      </section>
    </section>
    <section anchor="header" numbered="true" toc="default">
      <name>The Proxy-Status HTTP Field</name>
      <t>The Proxy-Status HTTP response field allows an intermediary to convey additional information about its handling of a response and its associated request.</t> 
      <t>Its value is a List (see <xref section="3.1" sectionFormat="of" target="STRUCTURED-FIELDS" format="default"/>). Each member of the List represents an intermediary that has handled the response. The first member represents the intermediary closest to the origin server, and the last member represents the intermediary closest to the user agent.</t>
      <t>For example:</t>
      <sourcecode type="http-message"><![CDATA[
Proxy-Status: revproxy1.example.net, ExampleCDN
]]></sourcecode>
      <t>indicates that this response was handled first by revproxy1.example.net (a reverse proxy adjacent to the origin server) and then ExampleCDN.</t>
      <t>Intermediaries determine when it is appropriate to add the Proxy-Status field to a response. Some might decide to append 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.</t>
      <t>Each member of the List identifies the intermediary that inserted the value and <bcp14>MUST</bcp14> have a type of either String or Token. Depending on the deployment, this might be a service name (but not a software or hardware product name; e.g., "ExampleCDN" 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.</t>
      <t>Parameters of each member (per <xref section="3.1.2" sectionFormat="of" target="STRUCTURED-FIELDS" format="default"/>) convey additional information about that intermediary's handling of the response and its associated request; see <xref target="params" format="default"/>. While all of these parameters are <bcp14>OPTIONAL</bcp14>, intermediaries are encouraged to provide as much information as possible (but see <xref target="security" format="default"/> for security considerations in doing so).</t>
      <t>When adding a value to the Proxy-Status field, intermediaries <bcp14>SHOULD</bcp14> 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 <xref target="security" format="default"/>).</t>
      <t>Origin servers <bcp14>MUST NOT</bcp14> generate the Proxy-Status field.</t>
      <t>Proxy-Status <bcp14>MAY</bcp14> be sent as an 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 <xref section="6.5" sectionFormat="of" target="HTTP" format="default"/>), Proxy-Status <bcp14>SHOULD NOT</bcp14> be sent as a trailer field unless it is not possible to send it in the header section.</t>
      <t>To allow recipients to reconstruct the relative ordering of Proxy-Status members conveyed in trailer fields with those conveyed in header fields, an intermediary <bcp14>MUST NOT</bcp14> 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.</t>
      <t>For example, a proxy identified as 'ThisProxy' that receives a response bearing a header field:</t>
      <sourcecode type="http-message"><![CDATA[
Proxy-Status: SomeOtherProxy
]]></sourcecode>
      <t>would add its own entry to the header field:</t>
      <sourcecode type="http-message"><![CDATA[
Proxy-Status: SomeOtherProxy, ThisProxy
]]></sourcecode>
      <t>thus allowing it to append a trailer field:</t>
      <sourcecode type="http-message"><![CDATA[
Proxy-Status: ThisProxy; error=read_timeout
]]></sourcecode>
      <t>which would thereby allow a downstream recipient to understand that processing by 'SomeOtherProxy' occurred before 'ThisProxy'.</t>
      <t>A client <bcp14>MAY</bcp14> promote the Proxy-Status trailer field into a header field by following these steps:</t>
      <ol spacing="normal" type="1"><li>
          <t>For each member trailer_member of the Proxy-Status trailer field value:
          </t>
          <ol spacing="normal" type="1"><li>Let header_member be the first (leftmost) value of the Proxy-Status header field value, comparing the String or Token character by character without consideration of parameters.</li>
            <li>If no matching header_member is found, continue processing the next trailer_member.</li>
            <li>Replace header_member with trailer_member in its entirety, including any parameters.</li>
          </ol>
        </li>
        <li>Remove the Proxy-Status trailer field if empty.</li>
      </ol>
      <section anchor="params" numbered="true" toc="default">
        <name>Proxy-Status Parameters</name>
        <t>This section lists parameters that can be used on the members of the Proxy-Status field. Unrecognised parameters <bcp14>MUST</bcp14> be ignored.</t>
        <section anchor="error" numbered="true" toc="default">
          <name>error</name>
          <t>The <tt>error</tt> parameter's value is a Token that is a proxy error type. When present, it indicates that the intermediary encountered an issue when obtaining this response.</t>
          <t>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.</t>
          <t>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.</t>
          <t>Proxy error types that are registered with a 'Response only generated by intermediaries' value of 'true' indicate that they can only occur in responses generated by the intermediary. If the value is 'false', the response might be generated by the intermediary or an inbound server.</t>
          <t><xref target="error-types" format="default"/> lists the proxy error types defined in this document; new ones can be defined using the procedure outlined in <xref target="register-error" format="default"/>.</t>
          <t>For example:</t>
          <sourcecode type="http-message"><![CDATA[
HTTP/1.1 504 Gateway Timeout
Proxy-Status: ExampleCDN; error=connection_timeout
]]></sourcecode>
          <t>indicates that this 504 response was generated by ExampleCDN due to a connection timeout when going forward.</t>
          <t>Or:</t>
          <sourcecode type="http-message"><![CDATA[
HTTP/1.1 429 Too Many Requests
Proxy-Status: r34.example.net; error=http_request_error, ExampleCDN
]]></sourcecode>
          <t>indicates that this 429 (Too Many Requests) response was generated by r34.example.net, not the CDN or the origin.</t>
          <t>When sending the error parameter, the most specific proxy error type <bcp14>SHOULD</bcp14> 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 <xref target="register-error" format="default"/>).</t>
          <t>Each proxy error type has a recommended HTTP status code. When generating an HTTP response containing the <tt>error</tt>, its HTTP status code <bcp14>SHOULD</bcp14> 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.</t>
          <t>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.</t>
        </section>
        <section anchor="next-hop" numbered="true" toc="default">
          <name>next-hop</name>
          <t>The <tt>next-hop</tt> parameter's value is a String or 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.</t>
          <t>For example:</t>
          <sourcecode type="http-message"><![CDATA[
Proxy-Status: cdn.example.org; next-hop=backend.example.org:8001
]]></sourcecode>
          <t>indicates that cdn.example.org used backend.example.org:8001 as the next hop for this request.</t>
        </section>
        <section anchor="next-protocol" numbered="true" toc="default">
          <name>next-protocol</name>
          <t>The <tt>next-protocol</tt> parameter's value indicates the Application-Layer Protocol Negotiation (ALPN) protocol identifier <xref target="RFC7301" format="default"/> of the protocol used by the intermediary to connect to the next hop when obtaining this response.</t>
         <t>The value <bcp14>MUST</bcp14> be either a Token or Byte Sequence representing a TLS ALPN Protocol ID (see <eref brackets="angle" target="https://www.iana.org/assignments/tls-extensiontype-values#alpn-protocol-ids"/>). If the protocol identifier is able to be expressed as a Token using ASCII encoding, that form <bcp14>MUST</bcp14> be used.</t>
          <t>For example:</t>
          <sourcecode type="http-message"><![CDATA[
Proxy-Status: "proxy.example.org"; next-protocol=h2
]]></sourcecode>
          <t>Note that the ALPN identifier is being used here to identify the protocol in use; it may or may not have been actually used in the protocol negotiation.</t>
        </section>
        <section anchor="received-status" numbered="true" toc="default">
          <name>received-status</name>
          <t>The <tt>received-status</tt> parameter's value indicates the HTTP status code that the intermediary received from the next-hop server when obtaining this response.</t>
          <t>The value <bcp14>MUST</bcp14> be an Integer.</t>
          <t>For example:</t>
          <sourcecode type="http-message"><![CDATA[
Proxy-Status: ExampleCDN; received-status=200
]]></sourcecode>
        </section>
        <section anchor="details" numbered="true" toc="default">
          <name>details</name>
          <t>The <tt>details</tt> parameter's value is a String containing additional information not captured anywhere else. This can include implementation-specific or deployment-specific information.</t>
          <t>For example:</t>
          <sourcecode type="http-message"><![CDATA[
Proxy-Status: proxy.example.net; error="http_protocol_error";
              details="Malformed response header: space before colon"
]]></sourcecode>
        </section>
      </section>
      <section anchor="register-param" numbered="true" toc="default">
        <name>Defining New Proxy-Status Parameters</name>
        <t>New Proxy-Status parameters can be defined by registering them in the "HTTP Proxy-Status Parameters" registry.</t>
        <t>Registration requests are reviewed and approved by Expert Review, per <xref section="4.5" sectionFormat="comma" target="RFC8126" format="default"/>. A specification document is appreciated but not required.</t>
        <t>The expert(s) should consider the following factors when evaluating requests:</t>
        <ul spacing="normal">
          <li>Community feedback</li>
          <li>If the value is sufficiently well defined</li>
          <li>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).</li>
          <li>Parameter names should not conflict with registered extra parameters in the "HTTP Proxy Error Types" registry.</li>
        </ul>
        <t>Registration requests should use the following template:</t>
        <dl>
          <dt>Name:</dt>
          <dd>[a name for the Proxy-Status parameter that matches key]</dd>
          <dt>Description:</dt>
          <dd>[a description of the parameter semantics and value]</dd>
          <dt>Reference:</dt>
          <dd>[to a specification defining this parameter; optional]</dd>
        </dl>
        <t>See the registry at <eref target="https://www.iana.org/assignments/http-proxy-status" brackets="angle"/> for details on where to send registration requests.</t>
      </section>
      <section anchor="error-types" numbered="true" toc="default">
        <name>Proxy Error Types</name>
        <t>This section lists the proxy error types defined by this document. See <xref target="register-error" format="default"/> for information about defining new proxy error types.</t>
        <t>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 therefore may not be applicable to some.</t>
        <section anchor="dns-timeout" numbered="true" toc="default">
          <name>DNS Timeout</name>
	  <dl>
            <dt>Name:</dt>
            <dd>dns_timeout</dd>
            <dt>Description:</dt>
            <dd>The intermediary encountered a timeout when trying to find an IP address for the next-hop hostname.</dd>
            <dt>Extra Parameters:</dt>
            <dd>None</dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>504</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>true</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="dns-error" numbered="true" toc="default">
          <name>DNS Error</name>
	  <dl>
	    <dt>Name:</dt>
            <dd>dns_error</dd>
            <dt>Description:</dt>
            <dd>The intermediary encountered a DNS error when trying to find an IP address for the next-hop hostname.</dd>
            <dt>Extra Parameters:</dt>
              <dd><t><br/></t>
		<dl>
                <dt>rcode:</dt>
                <dd> A String conveying the DNS RCODE that indicates the error type. See <xref section="3" sectionFormat="comma" target="RFC8499" format="default"/>.</dd>
                <dt>info-code:</dt>
                <dd>An Integer conveying the Extended DNS Error Code INFO-CODE. See <xref target="RFC8914" format="default"/>.</dd>
              </dl>
            </dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>502</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>true</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="destination-not-found" numbered="true" toc="default">
          <name>Destination Not Found</name>
          <dl>
            <dt>Name:</dt>
            <dd>destination_not_found</dd>
            <dt>Description:</dt>
            <dd>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.</dd>
            <dt>Extra Parameters:</dt>
            <dd>None</dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>500</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>true</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="destination-unavailable" numbered="true" toc="default">
          <name>Destination Unavailable</name>
          <dl>
            <dt>Name:</dt>
            <dd>destination_unavailable</dd>
            <dt>Description:</dt>
            <dd>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.</dd>
            <dt>Extra Parameters:</dt>
            <dd>None</dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>503</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>true</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="destination-ip-prohibited" numbered="true" toc="default">
          <name>Destination IP Prohibited</name>
          <dl>
            <dt>Name:</dt>
            <dd>destination_ip_prohibited</dd>
            <dt>Description:</dt>
            <dd>The intermediary is configured to prohibit connections to the next-hop IP address.</dd>
            <dt>Extra Parameters:</dt>
            <dd>None</dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>502</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>true</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="destination-ip-unroutable" numbered="true" toc="default">
          <name>Destination IP Unroutable</name>
          <dl>
            <dt>Name:</dt>
            <dd>destination_ip_unroutable</dd>
            <dt>Description:</dt>
            <dd>The intermediary cannot find a route to the next-hop IP address.</dd>
            <dt>Extra Parameters:</dt>
            <dd>None</dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>502</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>true</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="connection-refused" numbered="true" toc="default">
          <name>Connection Refused</name>
          <dl>
            <dt>Name:</dt>
            <dd>connection_refused</dd>
            <dt>Description:</dt>
            <dd>The intermediary's connection to the next hop was refused.</dd>
            <dt>Extra Parameters:</dt>
            <dd>None</dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>502</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>true</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="connection-terminated" numbered="true" toc="default">
          <name>Connection Terminated</name>
          <dl>
            <dt>Name:</dt>
            <dd>connection_terminated</dd>
            <dt>Description:</dt>
            <dd>The intermediary's connection to the next hop was closed before a complete response was received.</dd>
            <dt>Extra Parameters:</dt>
            <dd>None</dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>502</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>false</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="connection-timeout" numbered="true" toc="default">
          <name>Connection Timeout</name>
          <dl>
            <dt>Name:</dt>
            <dd>connection_timeout</dd>
            <dt>Description:</dt>
            <dd>The intermediary's attempt to open a connection to the next hop timed out.</dd>
            <dt>Extra Parameters:</dt>
            <dd>None</dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>504</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>true</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="connection-read-timeout" numbered="true" toc="default">
          <name>Connection Read Timeout</name>
          <dl>
            <dt>Name:</dt>
            <dd>connection_read_timeout</dd>
            <dt>Description:</dt>
            <dd>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.</dd>
            <dt>Extra Parameters:</dt>
            <dd>None</dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>504</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>false</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="connection-write-timeout" numbered="true" toc="default">
          <name>Connection Write Timeout</name>
          <dl>
            <dt>Name:</dt>
            <dd>connection_write_timeout</dd>
            <dt>Description:</dt>
            <dd>The intermediary was attempting to write data to a connection but was not able to (e.g., because its buffers were full).</dd>
            <dt>Extra Parameters:</dt>
            <dd>None</dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>504</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>false</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="connection-limit-reached" numbered="true" toc="default">
          <name>Connection Limit Reached</name>
          <dl>
            <dt>Name:</dt>
            <dd>connection_limit_reached</dd>
            <dt>Description:</dt>
            <dd>The intermediary is configured to limit the number of connections it has to the next hop, and that limit has been exceeded.</dd>
            <dt>Extra Parameters:</dt>
            <dd>None</dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>503</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>true</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="tls-protocol-error" numbered="true" toc="default">
          <name>TLS Protocol Error</name>
          <dl>
            <dt>Name:</dt>
            <dd>tls_protocol_error</dd>
            <dt>Description:</dt>
            <dd>The intermediary encountered a TLS error when communicating with the next hop, either during the handshake or afterwards.</dd>
            <dt>Extra Parameters:</dt>
            <dd>None</dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>502</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>false</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
            <dt>Notes:</dt>
            <dd>Not appropriate when a TLS alert is received; see tls_alert_received.</dd>
          </dl>
        </section>
        <section anchor="tls-certificate-error" numbered="true" toc="default">
          <name>TLS Certificate Error</name>
          <dl>
            <dt>Name:</dt>
            <dd>tls_certificate_error</dd>
            <dt>Description:</dt>
            <dd>The intermediary encountered an error when verifying the certificate presented by the next hop.</dd>
            <dt>Extra Parameters:</dt>
            <dd>None</dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>502</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>true</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="tls-alert-received" numbered="true" toc="default">
          <name>TLS Alert Received</name>
          <dl>
            <dt>Name:</dt>
            <dd>tls_alert_received</dd>
            <dt>Description:</dt>
            <dd>The intermediary received a TLS alert from the next hop.</dd>
            <dt>Extra Parameters:</dt>
            <dd><t><br/></t>
              <dl>
                <dt>alert-id:</dt>
                <dd>An Integer containing the applicable value from the "TLS Alerts" registry. See <xref target="TLS" format="default"/>.</dd>
                <dt>alert-message:</dt>
                <dd>A Token or String containing the applicable description string from the "TLS Alerts" registry. See <xref target="TLS" format="default"/>.</dd>
              </dl>
            </dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>502</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>false</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="http-request-error" numbered="true" toc="default">
          <name>HTTP Request Error</name>
          <dl>
            <dt>Name:</dt>
            <dd>http_request_error</dd>
            <dt>Description:</dt>
            <dd>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, and 429.</dd>
            <dt>Extra Parameters:</dt>
              <dd><t><br/></t>
                <dl>
                  <dt>status-code:</dt>
                  <dd>An Integer containing the generated status code.</dd>
                  <dt>status-phrase:</dt>
                  <dd>A String containing the generated status phrase.</dd>
               </dl>
            </dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>The applicable 4xx status code</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>true</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
            <dt>Notes:</dt>
            <dd>This type helps distinguish between responses generated by intermediaries from those generated by the origin.</dd>
          </dl>
        </section>
        <section anchor="http-request-denied" numbered="true" toc="default">
          <name>HTTP Request Denied</name>
          <dl>
            <dt>Name:</dt>
            <dd>http_request_denied</dd>
            <dt>Description:</dt>
            <dd>The intermediary rejected the HTTP request based on its configuration and/or policy settings. The request wasn't forwarded to the next hop.</dd>
            <dt>Extra Parameters:</dt>
            <dd>None</dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>403</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>true</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="http-incomplete-response" numbered="true" toc="default">
          <name>HTTP Incomplete Response</name>
          <dl>
            <dt>Name:</dt>
            <dd>http_response_incomplete</dd>
            <dt>Description:</dt>
            <dd>The intermediary received an incomplete response to the request from the next hop.</dd>
            <dt>Extra Parameters:</dt>
            <dd>None</dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>502</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>false</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="http-response-header-section-too-large" numbered="true" toc="default">
          <name>HTTP Response Header Section Too Large</name>
          <dl>
            <dt>Name:</dt>
            <dd>http_response_header_section_size</dd>
            <dt>Description:</dt>
            <dd>The intermediary received a response to the request whose header section was considered too large.</dd>
            <dt>Extra Parameters:</dt>
            <dd><t><br/></t>
              <dl>
                <dt>header-section-size:</dt>
                <dd>An Integer indicating how large the received headers were. Note that they might not be complete; i.e., the intermediary may have discarded or refused additional data.</dd>
              </dl>
            </dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>502</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>false</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="http-response-header-field-line-too-large" numbered="true" toc="default">
          <name>HTTP Response Header Field Line Too Large</name>
          <dl>
            <dt>Name:</dt>
            <dd>http_response_header_size</dd>
            <dt>Description:</dt>
            <dd>The intermediary received a response to the request containing an individual header field line that was considered too large.</dd>
            <dt>Extra Parameters:</dt>
            <dd><t><br/></t>
              <dl>
                <dt>header-name:</dt>
                <dd>A String indicating the name of the header field that triggered the error.</dd>
                <dt>header-size:</dt>
                <dd>An Integer indicating the size of the header field that triggered the error.</dd>
              </dl>
            </dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>502</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>false</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="http-response-body-too-large" numbered="true" toc="default">
          <name>HTTP Response Body Too Large</name>
          <dl>
            <dt>Name:</dt>
            <dd>http_response_body_size</dd>
            <dt>Description:</dt>
            <dd>The intermediary received a response to the request whose body was considered too large.</dd>
            <dt>Extra Parameters:</dt>
            <dd><t><br/></t>
              <dl>
                <dt>body-size:</dt>
                <dd>An Integer indicating how large the received body was. Note that it may not have been complete; i.e., the intermediary may have discarded or refused additional data.</dd>
              </dl>
            </dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>502</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>false</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="http-response-trailer-section-too-large" numbered="true" toc="default">
          <name>HTTP Response Trailer Section Too Large</name>
          <dl>
            <dt>Name:</dt>
            <dd>http_response_trailer_section_size</dd>
            <dt>Description:</dt>
            <dd>The intermediary received a response to the request whose trailer section was considered too large.</dd>            
            <dt>Extra Parameters:</dt>
            <dd><t><br/></t>
              <dl>
                <dt>trailer-section-size:</dt>
                <dd>An Integer indicating how large the received trailers were. Note that they might not be complete; i.e., the intermediary may have discarded or refused additional data.</dd>
              </dl>
            </dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>502</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>false</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="http-response-trailer-field-line-too-large" numbered="true" toc="default">
          <name>HTTP Response Trailer Field Line Too Large</name>
          <dl>
            <dt>Name:</dt>
            <dd>http_response_trailer_size</dd>
            <dt>Description:</dt>
            <dd>The intermediary received a response to the request containing an individual trailer field line that was considered too large.</dd>           
            <dt>Extra Parameters:</dt>
            <dd><t><br/></t>
              <dl>
                <dt>trailer-name:</dt>
                <dd>A String indicating the name of the trailer field that triggered the error.</dd>
                <dt>trailer-size:</dt>
                <dd>An Integer indicating the size of the trailer field that triggered the error.</dd>
              </dl>
            </dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>502</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>false</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="http-response-transfer-coding-error" numbered="true" toc="default">
          <name>HTTP Response Transfer-Coding Error</name>
          <dl>
            <dt>Name:</dt>
            <dd>http_response_transfer_coding</dd>
            <dt>Description:</dt>
            <dd>The intermediary encountered an error decoding the transfer coding of the response.</dd>            
            <dt>Extra Parameters:</dt>
            <dd><t><br/></t>
              <dl>
                <dt>coding:</dt>
                <dd>A Token containing the specific coding (from the "HTTP Transfer Coding Registry") that caused the error.</dd>
              </dl>
            </dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>502</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>false</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="http-response-content-coding-error" numbered="true" toc="default">
          <name>HTTP Response Content-Coding Error</name>
          <dl>
            <dt>Name:</dt>
            <dd>http_response_content_coding</dd>
            <dt>Description:</dt>
            <dd>The intermediary encountered an error decoding the content coding of the response.</dd>
              <dt>Extra Parameters:</dt>
              <dd><t><br/></t>
                <dl>
                  <dt>coding:</dt>
                  <dd>A Token containing the specific coding (from the "HTTP Content Coding Registry") that caused the error.</dd>
              </dl>
            </dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>502</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>false</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="http-response-timeout" numbered="true" toc="default">
          <name>HTTP Response Timeout</name>
          <dl>
            <dt>Name:</dt>
            <dd>http_response_timeout</dd>
            <dt>Description:</dt>
            <dd>The intermediary reached a configured time limit waiting for the complete response.</dd>
            <dt>Extra Parameters:</dt>
            <dd>None</dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>504</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>false</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="http-upgrade-failed" numbered="true" toc="default">
          <name>HTTP Upgrade Failed</name>
          <dl>
            <dt>Name:</dt>
            <dd>http_upgrade_failed</dd>
            <dt>Description:</dt>
            <dd>The process of negotiating an upgrade of the HTTP version between the intermediary and the next hop failed.</dd>
            <dt>Extra Parameters:</dt>
            <dd>None</dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>502</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>true</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="http-protocol-error" numbered="true" toc="default">
          <name>HTTP Protocol Error</name>
          <dl>
            <dt>Name:</dt>
            <dd>http_protocol_error</dd>
            <dt>Description:</dt>
            <dd>The intermediary encountered an HTTP protocol error when communicating with the next hop. This error should only be used when a more specific one is not defined.</dd>
            <dt>Extra Parameters:</dt>
            <dd>None</dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>502</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>false</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="proxy-internal-response" numbered="true" toc="default">
          <name>Proxy Internal Response</name>
          <dl>
            <dt>Name:</dt>
            <dd>proxy_internal_response</dd>
            <dt>Description:</dt>
            <dd>The intermediary generated the response itself without attempting to connect to the next hop.</dd>
            <dt>Extra Parameters:</dt>
            <dd>None</dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>The most appropriate status code for the response</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>true</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="proxy-internal-error" numbered="true" toc="default">
          <name>Proxy Internal Error</name>
          <dl>
            <dt>Name:</dt>
            <dd>proxy_internal_error</dd>
            <dt>Description:</dt>
            <dd>The intermediary encountered an internal error unrelated to the origin.</dd>
            <dt>Extra Parameters:</dt>
            <dd>None</dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>500</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>true</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="proxy-configuration-error" numbered="true" toc="default">
          <name>Proxy Configuration Error</name>
          <dl>
            <dt>Name:</dt>
            <dd>proxy_configuration_error</dd>
            <dt>Description:</dt>
            <dd>The intermediary encountered an error regarding its configuration.</dd>
            <dt>Extra Parameters:</dt>
            <dd>None</dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>500</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>true</dd>
            <dt>Reference:</dt>
            <dd>RFC 9209</dd>
          </dl>
        </section>
        <section anchor="proxy-loop-detected" numbered="true" toc="default">
          <name>Proxy Loop Detected</name>
          <dl>
            <dt>Name:</dt>
            <dd>proxy_loop_detected</dd>
            <dt>Description:</dt>
            <dd>The intermediary tried to forward the request to itself, or a loop has been detected using different means (e.g., <xref target="RFC8586" format="default"/>).</dd>
            <dt>Extra Parameters:</dt>
            <dd>None</dd>
            <dt>Recommended HTTP Status Code:</dt>
            <dd>502</dd>
            <dt>Response Only Generated by Intermediaries:</dt>
            <dd>true</dd>
            <dt>Reference:</dt><dd>RFC 9209</dd>
          </dl>
        </section>
      </section>
      <section anchor="register-error" numbered="true" toc="default">
        <name>Defining New Proxy Error Types</name>
        <t>New proxy error types can be defined by registering them in the "HTTP Proxy Error Types" registry.</t>
        <t>Registration requests are reviewed and approved by Expert Review, per <xref section="4.5" sectionFormat="comma" target="RFC8126" format="default"/>. A specification document is appreciated but not required.</t>
        <t>The expert(s) should consider the following factors when evaluating requests:</t>
        <ul spacing="normal">
          <li>Community feedback</li>
          <li>If the value is sufficiently well-defined</li>
          <li>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 type's name should be correspondingly specific (e.g., with a prefix that identifies the vendor, application, or deployment).</li>
          <li>Extra parameters should not conflict with registered Proxy-Status parameters.</li>
        </ul>
        <t>Registration requests should use the following template:</t>
        <dl>
          <dt>Name:</dt>
          <dd>[a name for the proxy error type that is of type Token]</dd>
          <dt>Description:</dt>
          <dd>[a description of the conditions that generate the proxy error type]</dd>
          <dt>Extra Parameters:</dt>
          <dd>[zero or more optional parameters, along with their allowable Structured Type(s)]</dd>
          <dt>Recommended HTTP Status Code:</dt>
          <dd>[the appropriate HTTP status code for this entry]</dd>
          <dt>Response Only Generated by Intermediaries:</dt>
          <dd>['true' or 'false']</dd>
          <dt>Reference:</dt>
          <dd>[to a specification defining this error type; optional]</dd>
          <dt>Notes:</dt>
          <dd>[optional]</dd>
        </dl>
        <t>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'.</t>
        <t>See the registry at <eref target="https://www.iana.org/assignments/http-proxy-status" brackets="angle"/> for details on where to send registration requests.</t>
      </section>
    </section>
    <section anchor="iana-considerations" numbered="true" toc="default">
      <name>IANA Considerations</name>
      <t>IANA has created the "HTTP Proxy-Status Parameters" registry and the "HTTP Proxy Error Types" registry at <eref target="https://www.iana.org/assignments/http-proxy-status" brackets="angle"/> and has populated them with the types defined in Sections <xref target="params" format="counter"/> and <xref target="error-types" format="counter"/> respectively; see Sections <xref target="register-param" format="counter"/> and <xref target="register-error" format="counter"/> for their associated procedures.</t>
      <t>Additionally, the following entry has been added to the "Hypertext Transfer Protocol (HTTP) Field Name Registry":</t>
      <dl spacing="compact">
        <dt>Field name:</dt>
        <dd>Proxy-Status</dd>
        <dt>Status:</dt>
        <dd>permanent</dd>
        <dt>Specification document(s):</dt>
        <dd>RFC 9209</dd>
        <dt>Comments:</dt>
        <dd/>
      </dl>
    </section>
    <section anchor="security" numbered="true" toc="default">
      <name>Security Considerations</name>
      <t>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 backend topology can be exposed, allowing attackers to directly target backend services that are not prepared for high traffic volume or malformed inputs.  Some information might only be suitable to reveal to authorized parties.</t>
      <t>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).</t>
      <t>Likewise, generation of all parameters is optional, as is the 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.</t>
    </section>
  </middle>
  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <reference anchor='HTTP' target='https://www.rfc-editor.org/info/rfc9110'>
          <front>
            <title>HTTP Semantics</title>
            <author initials='R' surname='Fielding' fullname='Roy Fielding' role="editor">
              <organization />
            </author>
            <author initials='M' surname='Nottingham' fullname='Mark Nottingham' role="editor">
              <organization />
            </author>
            <author initials='J' surname='Reschke' fullname='Julian Reschke' role="editor">
              <organization />
            </author>
            <date year='2022' month='June'/>
          </front>
          <seriesInfo name="STD" value="97"/>
          <seriesInfo name="RFC" value="9110"/>
          <seriesInfo name="DOI" value="10.17487/RFC9110"/>
        </reference>
        <reference anchor="STRUCTURED-FIELDS" target='https://www.rfc-editor.org/info/rfc8941'>
          <front>
            <title>Structured Field Values for HTTP</title>
            <author fullname="M. Nottingham" initials="M." surname="Nottingham">
              <organization/>
            </author>
            <author fullname="P-H. Kamp" initials="P-H." surname="Kamp">
              <organization/>
            </author>
            <date month="March" year="2021"/>
          </front>
          <seriesInfo name="RFC" value="8941"/>
          <seriesInfo name="DOI" value="10.17487/RFC8941"/>
        </reference>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8126.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8499.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.7301.xml"/>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8914.xml"/>
        <reference anchor="TLS" target="https://www.rfc-editor.org/info/rfc8446">
          <front>
            <title>The Transport Layer Security (TLS) Protocol Version 1.3</title>
            <author initials="E." surname="Rescorla" fullname="Eric Rescorla"/>
            <date year="2018" month="August"/>
          </front>
          <seriesInfo name="RFC" value="8446"/>
          <seriesInfo name="DOI" value="10.17487/RFC8446"/>
        </reference>
      </references>
      <references>
        <name>Informative References</name>
        <xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8586.xml"/>
      </references>
    </references>
  </back>
</rfc>
