<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- generated by https://github.com/cabo/kramdown-rfc version 1.7.4 (Ruby 2.6.4) -->
<?rfc-ext html-pretty-print="prettyprint https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js"?>
<rfc xmlns:x="http://purl.org/net/xml2rfc/ext"
      category="std"
      consensus="true"
      docName="draft-ietf-httpbis-alias-proxy-status-07"
      ipr="trust200902"
      sortRefs="true"
      symRefs="true"
      tocInclude="true">
   <x:feedback template="mailto:ietf-http-wg@w3.org?subject={docname},%20%22{section}%22\&amp;amp;body=%3c{ref}%3e:"/>
   <front>
      <title abbrev="DNS Aliases Proxy-Status">HTTP Proxy-Status Parameter for Next-Hop Aliases</title>
      <author fullname="Tommy Pauly" initials="T." surname="Pauly">
         <organization>Apple, Inc.</organization>
         <address>
            <email>tpauly@apple.com</email>
         </address>
      </author>
      <date year="2023" month="December" day="13"/>
      <area>Applications and Real-Time</area>
      <workgroup>HTTP</workgroup>
      <keyword>proxy status</keyword>
      <abstract><?line 43?>
         <t>This document defines the <spanx style="verb">next-hop-aliases</spanx> HTTP Proxy-Status Parameter. This parameter carries the list of aliases and canonical names an intermediary received during DNS resolution as part of establishing a connection to the next hop.</t>
      </abstract>
      <note removeInRFC="true" title="About This Document">
         <t>Status information for this document may be found at <eref target="https://datatracker.ietf.org/doc/draft-ietf-httpbis-alias-proxy-status/"/>.</t>
         <t>Discussion of this document takes place on the HTTP Working Group mailing list (<eref target="mailto:ietf-http-wg@w3.org"/>), which is archived at <eref target="https://lists.w3.org/Archives/Public/ietf-http-wg/"/>. Working Group information can be found at <eref target="https://httpwg.org/"/>.</t>
         <t>Source for this draft and an issue tracker can be found at <eref target="https://github.com/httpwg/http-extensions/labels/alias-proxy-status"/>.</t>
      </note>
   </front>
   <middle><?line 49?>
      <section anchor="introduction">
         <name>Introduction</name>
         <t>The Proxy-Status HTTP response field <xref target="PROXY-STATUS"/> allows intermediaries to convey information about how they handled the request in HTTP responses sent to clients. It defines a set of parameters that provide information, such as the name of the next hop.</t>
         <t>
            <xref target="PROXY-STATUS"/> defines a <spanx style="verb">next-hop</spanx> parameter, which can contain a hostname, IP address, or alias of the next hop. This parameter can contain only one such item, so it cannot be used to communicate a chain of aliases encountered during DNS resolution when connecting to the next hop.</t>
         <t>Knowing the full chain of names that were used during DNS resolution via CNAME records <xref target="DNS"/> is particularly useful for clients of forward proxies, in which the client is requesting to connect to a specific target hostname using the CONNECT method <xref target="HTTP"/> or UDP proxying <xref target="CONNECT-UDP"/>. CNAME records can be used to "cloak" hosts that perform tracking or malicious activity behind more innocuous hostnames, and clients such as web browsers use the chain of DNS names to influence behavior like cookie usage policies <xref target="COOKIES"/> or blocking of malicious hosts.</t>
         <t>This document allows clients to receive the CNAME chain of DNS names for the next hop by including the list of names in a new <spanx style="verb">next-hop-aliases</spanx> Proxy-Status parameter.</t>
         <section anchor="requirements">
            <name>Requirements</name>
            <t>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 <xref target="RFC2119"/>
               <xref target="RFC8174"/> when, and only when, they appear in all capitals, as shown here.<?line -6?></t>
         </section>
      </section>
      <section anchor="parameter">
         <name>next-hop-aliases Parameter</name>
         <t>The <spanx style="verb">next-hop-aliases</spanx> parameter's value is a String <xref target="STRUCTURED-FIELDS"/> that contains one or more DNS names in a comma-separated list. The items in the list include all alias names and canonical names received in CNAME records <xref target="DNS"/> during the course of resolving the next hop's hostname using DNS, and MAY include the original requested hostname itself. The names ought to appear in the order in which they were received in DNS, for the sake of consistency. If there are multiple CNAME records in the chain, the first name in the <spanx style="verb">next-hop-aliases</spanx> list would be the value in the CNAME record for the original hostname, and the final name in the <spanx style="verb">next-hop-aliases</spanx> list would be the name that ultimately resolved to one or more addresses.</t>
         <t>The list of DNS names in <spanx style="verb">next-hop-aliases</spanx> uses a comma (",") as a separator between names. Note that if a comma is included in a name itself, the comma must be encoded as described in <xref target="encoding"/>.</t>
         <t>For example, consider a proxy "proxy.example.net" that receives the following records when performing DNS resolution for the next hop "host.example.com":</t>
         <figure>
            <sourcecode type="dns-example">
host.example.com.           CNAME   tracker.example.com.
tracker.example.com.        CNAME   service1.example.com.
service1.example.com.       AAAA    2001:db8::1
</sourcecode>
         </figure>
         <t>The proxy could include the following proxy status in its response:</t>
         <figure>
            <sourcecode type="http-message">
Proxy-Status: proxy.example.net; next-hop="2001:db8::1";
    next-hop-aliases="tracker.example.com,service1.example.com"
</sourcecode>
         </figure>
         <t>This indicates that proxy.example.net, which used the IP address "2001:db8::1" as the next hop for this request, encountered the names "tracker.example.com" and "service1.example.com" in the DNS resolution chain. Note that while this example includes both the <spanx style="verb">next-hop</spanx> and <spanx style="verb">next-hop-aliases</spanx> parameters, <spanx style="verb">next-hop-aliases</spanx> can be included without including <spanx style="verb">next-hop</spanx>.</t>
         <t>The proxy can also include the name of the next hop as the first item in the list. This is particularly useful for reverse proxies when clients would not otherwise know the name of the next hop, and the <spanx style="verb">next-hop</spanx> header is used to convey an IP address.</t>
         <t>For example, consider a proxy "reverseproxy.example.net" that receives the following records when performing DNS resolution for the next hop "host.example.com":</t>
         <figure>
            <sourcecode type="dns-example">
host2.example.com.          CNAME   service2.example.com.
service2.example.com.       AAAA    2001:db8::2
</sourcecode>
         </figure>
         <t>The proxy could include the following proxy status in its response:</t>
         <figure>
            <sourcecode type="http-message">
Proxy-Status: reverseproxy.example.net; next-hop="2001:db8::2";
    next-hop-aliases="host2.example.com,service2.example.com"
</sourcecode>
         </figure>
         <t>The <spanx style="verb">next-hop-aliases</spanx> parameter only applies when DNS was used to resolve the next hop's name, and does not apply in all situations. Clients can use the information in this parameter to determine how to use the connection established through the proxy, but need to gracefully handle situations in which this parameter is not present.</t>
         <t>The proxy MAY send the empty string ("") as the value of <spanx style="verb">next-hop-aliases</spanx> to indicate that no CNAME records were encountered when resolving the next hop's name.</t>
         <section anchor="encoding">
            <name>Encoding special characters</name>
            <t>DNS names commonly just contain alphanumeric characters and hyphens ("-"), although they are allowed to contain any character (<xref section="3.1" sectionFormat="comma" target="RFC1035"/>), including a comma. To prevent commas or other special characters in names leading to incorrect parsing, any characters that appear in names in this list that do not belong to the set of URI Unreserved Characters (<xref section="2.3" sectionFormat="comma" target="RFC3986"/>) MUST be percent-encoded as defined in <xref section="2.1" sectionFormat="comma" target="RFC3986"/>.</t>
            <t>For example, consider the DNS name <spanx style="verb">comma,name.example.com</spanx>. This name would be encoded within a <spanx style="verb">next-hop-aliases</spanx> parameter as follows:</t>
            <figure>
               <sourcecode type="http-message">
Proxy-Status: proxy.example.net; next-hop="2001:db8::1";
    next-hop-aliases="comma%2Cname.example.com,service1.example.com"
</sourcecode>
            </figure>
            <t>It is also possible for a DNS name to include a period character (".") within a label, instead of as a label separator. In this case, the period character MUST be first escaped as "\.". Since the "\" character itself will be percent-encoded, the name "dot\.label.example.com" would be encoded within a <spanx style="verb">next-hop-aliases</spanx> parameter as follows:</t>
            <figure>
               <sourcecode type="http-message">
Proxy-Status: proxy.example.net; next-hop="2001:db8::1";
    next-hop-aliases="dot%5C.label.example.com,service1.example.com"
</sourcecode>
            </figure>
            <t>Upon parsing this name, "dot%5C.label" MUST be treated as a single label.</t>
            <t>Similarly the "\" character in a label MUST be escaped as "\\" and then percent-encoded. Other uses of "\" MUST NOT appear in the label after percent-decoding. For example, if there is a DNS name "backslash\name.example.com", it would first be escaped as "backslash\\name.example.com", and then percent-encoded as follows:</t>
            <figure>
               <sourcecode type="http-message">
Proxy-Status: proxy.example.net; next-hop="2001:db8::1";
    next-hop-aliases="backslash%5C%5Cname.example.com,service1.example.com"
</sourcecode>
            </figure>
         </section>
      </section>
      <section anchor="implementation-considerations">
         <name>Implementation Considerations</name>
         <t>In order to include the <spanx style="verb">next-hop-aliases</spanx> parameter, a proxy needs to have access to the chain of alias names and canonical names received in CNAME records.</t>
         <t>Implementations ought to note that the full chain of names might not be available in common DNS resolution APIs, such as <spanx style="verb">getaddrinfo</spanx>
            <xref target="POSIX"/>. <spanx style="verb">getaddrinfo</spanx> does have an option for <spanx style="verb">AI_CANONNAME</spanx> (<xref section="6.1" sectionFormat="of" target="RFC3493"/>), but this will only return the last name in the chain (the canonical name), not the alias names.</t>
         <t>An implementation MAY include incomplete information in the <spanx style="verb">next-hop-aliases</spanx> parameter to accommodate cases where it is unable to include the full chain, such as only including the canonical name if the implementation can only use <spanx style="verb">getaddrinfo</spanx> as described above.</t>
      </section>
      <section anchor="sec-considerations">
         <name>Security Considerations</name>
         <t>The <spanx style="verb">next-hop-aliases</spanx> parameter does not include any DNSSEC information or imply that DNSSEC was used. The information included in the parameter can only be trusted to be valid insofar as the client trusts the proxy to provide accurate information. This information is intended to be used as a hint, and SHOULD NOT be used for making security decisions about the identity of a resource accessed through the proxy.</t>
         <t>Inspecting CNAME chains can be used to detect cloaking of trackers or malicious hosts. However, the CNAME records could be omitted by a recursive or authoritative resolver that is trying to hide this form of cloaking. In particular, recursive or authoritative resolvers can omit these records for both clients directly performing DNS name resolution and proxies performing DNS name resolution on behalf of client. A malicious proxy could also choose to not report these CNAME chains in order to hide the cloaking. In general, clients can trust information included (or not included) in the <spanx style="verb">next-hop-aliases</spanx> parameter to the degree that the proxy and any resolvers used by the proxy are trusted.</t>
      </section>
      <section anchor="iana-considerations">
         <name>IANA Considerations</name>
         <t>This document registers the "next-hop-aliases" parameter in the "HTTP Proxy-Status Parameters" registry &lt;<eref target="https://www.iana.org/assignments/http-proxy-status"/>&gt;.</t>
         <dl>
            <dt>Name:</dt>
            <dd>
               <t>next-hop-aliases</t>
            </dd>
            <dt>Description:</dt>
            <dd>
               <t>A string containing one or more DNS aliases or canonical names used to establish a proxied connection to the next hop.</t>
            </dd>
            <dt>Reference:</dt>
            <dd>
               <t>This document</t>
            </dd>
         </dl>
      </section>
   </middle>
   <back>
      <references anchor="sec-normative-references" title="Normative References">
         <reference anchor="PROXY-STATUS">
            <front>
               <title>The Proxy-Status HTTP Response Header Field</title>
               <author fullname="M. Nottingham" initials="M." surname="Nottingham"/>
               <author fullname="P. Sikora" initials="P." surname="Sikora"/>
               <date month="June" year="2022"/>
            </front>
            <seriesInfo name="RFC" value="9209"/>
            <seriesInfo name="DOI" value="10.17487/RFC9209"/>
         </reference>
         <reference anchor="DNS">
            <front>
               <title>Domain names - concepts and facilities</title>
               <author fullname="P. Mockapetris" initials="P." surname="Mockapetris"/>
               <date month="November" year="1987"/>
            </front>
            <seriesInfo name="STD" value="13"/>
            <seriesInfo name="RFC" value="1034"/>
            <seriesInfo name="DOI" value="10.17487/RFC1034"/>
         </reference>
         <reference anchor="HTTP">
            <front>
               <title>HTTP Semantics</title>
               <author fullname="R. Fielding"
                        initials="R."
                        role="editor"
                        surname="Fielding"/>
               <author fullname="M. Nottingham"
                        initials="M."
                        role="editor"
                        surname="Nottingham"/>
               <author fullname="J. Reschke"
                        initials="J."
                        role="editor"
                        surname="Reschke"/>
               <date month="June" year="2022"/>
            </front>
            <seriesInfo name="STD" value="97"/>
            <seriesInfo name="RFC" value="9110"/>
            <seriesInfo name="DOI" value="10.17487/RFC9110"/>
         </reference>
         <reference anchor="CONNECT-UDP">
            <front>
               <title>Proxying UDP in HTTP</title>
               <author fullname="D. Schinazi" initials="D." surname="Schinazi"/>
               <date month="August" year="2022"/>
            </front>
            <seriesInfo name="RFC" value="9298"/>
            <seriesInfo name="DOI" value="10.17487/RFC9298"/>
         </reference>
         <reference anchor="RFC2119">
            <front>
               <title>Key words for use in RFCs to Indicate Requirement Levels</title>
               <author fullname="S. Bradner" initials="S." surname="Bradner"/>
               <date month="March" year="1997"/>
            </front>
            <seriesInfo name="BCP" value="14"/>
            <seriesInfo name="RFC" value="2119"/>
            <seriesInfo name="DOI" value="10.17487/RFC2119"/>
         </reference>
         <reference anchor="RFC8174">
            <front>
               <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
               <author fullname="B. Leiba" initials="B." surname="Leiba"/>
               <date month="May" year="2017"/>
            </front>
            <seriesInfo name="BCP" value="14"/>
            <seriesInfo name="RFC" value="8174"/>
            <seriesInfo name="DOI" value="10.17487/RFC8174"/>
         </reference>
         <reference anchor="STRUCTURED-FIELDS">
            <front>
               <title>Structured Field Values for HTTP</title>
               <author fullname="M. Nottingham" initials="M." surname="Nottingham"/>
               <author fullname="P-H. Kamp" surname="P-H. Kamp"/>
               <date month="February" year="2021"/>
            </front>
            <seriesInfo name="RFC" value="8941"/>
            <seriesInfo name="DOI" value="10.17487/RFC8941"/>
         </reference>
         <reference anchor="RFC3986">
            <front>
               <title>Uniform Resource Identifier (URI): Generic Syntax</title>
               <author fullname="T. Berners-Lee" initials="T." surname="Berners-Lee"/>
               <author fullname="R. Fielding" initials="R." surname="Fielding"/>
               <author fullname="L. Masinter" initials="L." surname="Masinter"/>
               <date month="January" year="2005"/>
            </front>
            <seriesInfo name="STD" value="66"/>
            <seriesInfo name="RFC" value="3986"/>
            <seriesInfo name="DOI" value="10.17487/RFC3986"/>
         </reference>
      </references>
      <references anchor="sec-informative-references" title="Informative References">
         <reference anchor="POSIX"
                     target="http://ieeexplore.ieee.org/servlet/opac?punumber=6506089">
            <front>
               <title>Standard for Information Technology Portable Operating System Interface (POSIX(R)) Base Specifications, Issue 7</title>
               <author>
                  <organization>IEEE</organization>
               </author>
               <date month="April" year="2013"/>
            </front>
            <seriesInfo name="DOI" value="10.1109/ieeestd.2013.6506091"/>
         </reference>
         <reference anchor="COOKIES">
            <front>
               <title>HTTP State Management Mechanism</title>
               <author fullname="A. Barth" initials="A." surname="Barth"/>
               <date month="April" year="2011"/>
            </front>
            <seriesInfo name="RFC" value="6265"/>
            <seriesInfo name="DOI" value="10.17487/RFC6265"/>
         </reference>
         <reference anchor="RFC1035">
            <front>
               <title>Domain names - implementation and specification</title>
               <author fullname="P. Mockapetris" initials="P." surname="Mockapetris"/>
               <date month="November" year="1987"/>
            </front>
            <seriesInfo name="STD" value="13"/>
            <seriesInfo name="RFC" value="1035"/>
            <seriesInfo name="DOI" value="10.17487/RFC1035"/>
         </reference>
         <reference anchor="RFC3493">
            <front>
               <title>Basic Socket Interface Extensions for IPv6</title>
               <author fullname="R. Gilligan" initials="R." surname="Gilligan"/>
               <author fullname="S. Thomson" initials="S." surname="Thomson"/>
               <author fullname="J. Bound" initials="J." surname="Bound"/>
               <author fullname="J. McCann" initials="J." surname="McCann"/>
               <author fullname="W. Stevens" initials="W." surname="Stevens"/>
               <date month="February" year="2003"/>
            </front>
            <seriesInfo name="RFC" value="3493"/>
            <seriesInfo name="DOI" value="10.17487/RFC3493"/>
         </reference>
      </references>
   </back>
</rfc>
