<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- generated by https://github.com/cabo/kramdown-rfc2629 version 1.2.9 -->
<?rfc toc="yes"?>
<?rfc sortrefs="yes"?>
<?rfc symrefs="yes"?>
<?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"
     number="8586"
     ipr="trust200902"
     submissionType="IETF">
   <front>
      <title abbrev="CDN Loop Detection">Loop Detection in Content Delivery Networks (CDNs)</title>
      <author fullname="Stephen Ludin" initials="S." surname="Ludin">
         <organization>Akamai Technologies</organization>
         <address>
            <email>sludin@akamai.com</email>
         </address>
      </author>
      <author fullname="Mark Nottingham" initials="M." surname="Nottingham">
         <organization>Fastly</organization>
         <address>
            <email>mnot@fastly.com</email>
         </address>
      </author>
      <author fullname="Nick Sullivan" initials="N." surname="Sullivan">
         <organization>Cloudflare</organization>
         <address>
            <email>nick@cloudflare.com</email>
         </address>
      </author>
      <date month="April" year="2019"/>
      <area>Applications and Real-Time</area>
      <workgroup>HTTP</workgroup>
      <keyword>Internet-Draft</keyword>
      <abstract>
         <t>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.</t>
      </abstract>
   </front>
   <middle>
      <section anchor="introduction" title="Introduction">
         <t>In modern deployments of HTTP servers, it is common to interpose Content Delivery Networks (CDNs) in front of origin servers to improve latency perceived by end users, reduce operational costs, and improve scalability and reliability of services.</t>
         <t>Often, more than one CDN is in use by a given origin. This happens for a variety of reasons, such as cost savings, arranging for failover should one CDN have issues, or direct comparison of the CDNs' services.</t>
         <t>As a result, it is possible for forwarding CDNs to be configured in a "loop" accidentally; because routing is achieved through a combination of DNS and forwarding rules, and site configurations are sometimes complex and managed by several parties.</t>
         <t>When this happens, it is difficult to debug. Additionally, it sometimes isn't accidental; loops between multiple CDNs can be used as an attack vector (e.g., see <xref target="loop-attack"/>), especially if one CDN unintentionally strips the loop detection headers of another.</t>
         <t>This specification defines the CDN-Loop HTTP request header field to help detect such attacks and accidents among forwarding CDNs that have implemented it; the header field may not be modified by their customers.</t>
         <section anchor="relationship-to-via" title="Relationship to Via">
            <t>HTTP defines the Via header field in <xref target="RFC7230" x:fmt="of" x:sec="5.7.1"/> for "tracking message forwards, avoiding request loops, and identifying the protocol capabilities of senders along the request/response chain."</t>
            <t>In theory, Via could be used to identify these loops. However, in practice it is not used in this fashion, because some HTTP servers use Via for other purposes -- in particular, some implementations disable some HTTP/1.1 features when the Via header is present.</t>
         </section>
         <section anchor="conventions-and-definitions"
                  title="Conventions and Definitions">
            <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.</t>
            <t>This specification uses the Augmented Backus-Naur Form (ABNF) notation of <xref target="RFC5234"/> with a list extension, defined in <xref target="RFC7230" x:fmt="of" x:sec="7"/>, that allows for compact definition of comma-separated lists using a ‘#' operator (similar to how the ‘*' operator indicates repetition). Additionally, it uses a token (OWS), uri-host, and port rules from <xref target="RFC7230"/> and the parameter rule from <xref target="RFC7231"/>.</t>
         </section>
      </section>
      <section anchor="header" title="The CDN-Loop Request Header Field">
         <t>The CDN-Loop request header field is intended to help a Content Delivery Network identify when an incoming request has already passed through that CDN's servers to detect loops.</t>
         <figure>
            <artwork type="abnf">
CDN-Loop  = #cdn-info
cdn-info  = cdn-id *( OWS ";" OWS parameter )
cdn-id    = ( uri-host [ ":" port ] ) / pseudonym
pseudonym = token
</artwork>
         </figure>
         <t>The cdn-id identifies the CDN using either a hostname under its control or a pseudonym. Hostnames are preferred, to help avoid accidental collisions. If a pseudonym is used, unintentional collisions are more likely, and therefore values should be carefully chosen to prevent them; for example, using a well-known value (such as the recognized name of the CDN in question), or a generated value with enough entropy to make collisions unlikely (such as a UUID <xref target="RFC4122"/>).</t>
         <t>Optionally, cdn-info can have semicolon-separated key/value parameters to accommodate additional information for the CDN's use.</t>
         <t>Conforming Content Delivery Networks SHOULD add a cdn-info to this header field in all requests they generate or forward (creating the header field if necessary).</t>
         <t>As with all HTTP header fields defined using the "#" rule, the CDN-Loop header field can be added to by comma-separating values, or by creating a new header field with the desired value.</t>
         <t>For example:</t>
         <figure>
            <artwork type="example">
GET /image.jpg HTTP/1.1
Host: cdn-customer.example
User-Agent: ExampleBrowser/5
CDN-Loop: foo123.foocdn.example, barcdn.example; trace="abcdef"
CDN-Loop: AnotherCDN; abc=123; def="456"

</artwork>
         </figure>
         <t>Note that the pseudonym syntax does not allow whitespace, DQUOTE, or any of the characters "(),/:;&lt;=&gt;?@[]{}". See <xref target="RFC7230" x:fmt="of" x:sec="3.2.6"/>. Likewise, note the rules for when parameter values need to be quoted in <xref target="RFC7231" x:fmt="of" x:sec="3.1.1"/>.</t>
         <t>The effectiveness of this mechanism relies on all intermediaries preserving the header field, since removing (or allowing it to be removed, e.g., by customer configuration) would prevent downstream CDNs from using it to detect looping. In general, unknown header fields are not removed by intermediaries, but there may be a need to add CDN-Loop to an implementation's list of header fields that are not to be removed under any circumstances. The header field SHOULD NOT be used for other purposes.</t>
      </section>
      <section anchor="security-considerations" title="Security Considerations">
         <t>The threat model that the CDN-Loop header field addresses is a customer who is attacking a service provider by configuring a forwarding loop by accident or malice. For it to function, CDNs cannot allow customers to modify or remove it in their configuration (see <xref target="header"/>).</t>
         <t>Note that a CDN that allows customers to remove or modify the CDN-Loop header field (i.e., they do not implement this specification) remains an attack vector against both implementing and non-implementing CDNs.</t>
         <t>A CDN's use of the CDN-Loop header field might expose its presence. For example, if CDN A is configured to forward its requests to CDN B for a given origin, CDN B's presence can be revealed if it behaves differently based upon the presence of the CDN-Loop header field.</t>
         <t>The CDN-Loop header field can be generated by any client, and therefore its contents cannot be trusted. CDNs who modify their behavior based upon its contents should assure that this does not become an attack vector (e.g., for Denial of Service).</t>
         <t>It is possible to sign the contents of the header field (either by putting the signature directly into the field's content or using another header field), but such use is not defined (or required) by this specification.</t>
         <t>Depending on how it is used, CDN-Loop can expose information about the internal configuration of the CDN; for example, the number of hops inside the CDN, and the hostnames of nodes.</t>
      </section>
      <section anchor="iana-considerations" title="IANA Considerations">
         <t>This document registers the "CDN-Loop" header field in the "Permanent Message Header Field Names" registry.</t>
         <t>
            <list style="symbols">
               <t>Header Field Name: CDN-Loop</t>
               <t>Protocol: http</t>
               <t>Status: standard</t>
               <t>Reference: RFC 8586</t>
            </list>
         </t>
      </section>
   </middle>
   <back>
      <references title="Normative References">
         <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="RFC7230">
            <front>
               <title>Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</title>
               <author fullname="R. Fielding"
                       initials="R."
                       role="editor"
                       surname="Fielding"/>
               <author fullname="J. Reschke"
                       initials="J."
                       role="editor"
                       surname="Reschke"/>
               <date month="June" year="2014"/>
            </front>
            <seriesInfo name="RFC" value="7230"/>
            <seriesInfo name="DOI" value="10.17487/RFC7230"/>
         </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="RFC5234">
            <front>
               <title>Augmented BNF for Syntax Specifications: ABNF</title>
               <author fullname="D. Crocker"
                       initials="D."
                       role="editor"
                       surname="Crocker"/>
               <author fullname="P. Overell" initials="P." surname="Overell"/>
               <date month="January" year="2008"/>
            </front>
            <seriesInfo name="STD" value="68"/>
            <seriesInfo name="RFC" value="5234"/>
            <seriesInfo name="DOI" value="10.17487/RFC5234"/>
         </reference>
         <reference anchor="RFC7231">
            <front>
               <title>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</title>
               <author fullname="R. Fielding"
                       initials="R."
                       role="editor"
                       surname="Fielding"/>
               <author fullname="J. Reschke"
                       initials="J."
                       role="editor"
                       surname="Reschke"/>
               <date month="June" year="2014"/>
            </front>
            <seriesInfo name="RFC" value="7231"/>
            <seriesInfo name="DOI" value="10.17487/RFC7231"/>
         </reference>
      </references>
      <references title="Informative References">
         <reference anchor="loop-attack"
                    target="http://www.icir.org/vern/papers/cdn-loops.NDSS16.pdf">
            <front>
               <title>Forwarding-Loop Attacks in Content Delivery Networks</title>
               <author fullname="Jianjun Chen" initials="J." surname="Chen"/>
               <author fullname="Jian Jiang" initials="J." surname="Jiang"/>
               <author fullname="Xiaofeng Zheng" initials="X." surname="Zheng"/>
               <author fullname="Haixin Duan" initials="H." surname="Duan"/>
               <author fullname="Jinjin Liang" initials="J." surname="Liang"/>
               <author fullname="Kang Li" initials="K." surname="Li"/>
               <author fullname="Tao Wan" initials="T." surname="Wan"/>
               <author fullname="Vern Paxson" initials="V." surname="Paxson"/>
               <date month="February" year="2016"/>
            </front>
         </reference>
         <reference anchor="RFC4122">
            <front>
               <title>A Universally Unique IDentifier (UUID) URN Namespace</title>
               <author fullname="P. Leach" initials="P." surname="Leach"/>
               <author fullname="M. Mealling" initials="M." surname="Mealling"/>
               <author fullname="R. Salz" initials="R." surname="Salz"/>
               <date month="July" year="2005"/>
            </front>
            <seriesInfo name="RFC" value="4122"/>
            <seriesInfo name="DOI" value="10.17487/RFC4122"/>
         </reference>
      </references>
   </back>
</rfc>
