<?xml version='1.0' encoding='US-ASCII'?>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- generated by https://github.com/cabo/kramdown-rfc2629 version 1.2.10 -->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc sortrefs="yes"?>
<?rfc symrefs="yes"?>
<rfc number="8586" ipr="trust200902"
   category="std" consensus="yes" submissionType="IETF" xml:lang="en">
  <front>
    <title abbrev="CDN Loop Detection">Loop Detection in Content Delivery Networks (CDNs)</title>
    <author initials="S." surname="Ludin" fullname="Stephen Ludin">
      <organization>Akamai Technologies</organization>
      <address>
        <email>sludin@akamai.com</email>
      </address>
    </author>
    <author initials="M." surname="Nottingham" fullname="Mark Nottingham">
      <organization>Fastly</organization>
      <address>
        <email>mnot@fastly.com</email>
      </address>
    </author>
    <author initials="N." surname="Sullivan" fullname="Nick Sullivan">
      <organization>Cloudflare</organization>
      <address>
        <email>nick@cloudflare.com</email>
      </address>
    </author>
    <date year="2019" month="April"/>
    <area>Applications and Real-Time</area>
    <workgroup>HTTP</workgroup>

<keyword>Content Delivery Network</keyword>
<keyword>HTTP</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" numbered="true" toc="default">
      <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" pageno="false" format="default"/>), 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" numbered="true" toc="default">
        <t>HTTP defines the Via header field in Section 5.7.1 of <xref target="RFC7230" pageno="false" format="default"/> 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"
	       numbered="true" toc="default">

        <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&nbsp;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" pageno="false" format="default"/> with a list
extension, defined in Section 7 of <xref target="RFC7230" pageno="false" format="default"/>, 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" pageno="false" format="default"/> and the parameter
rule from <xref target="RFC7231" pageno="false" format="default"/>.</t>
      </section>
    </section>
    <section anchor="header" title="The CDN-Loop Request Header Field" numbered="true" toc="default">
      <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 title="" suppress-title="false" align="left" alt="" width="" height="">
        <artwork type="abnf" xml:space="preserve" name="" align="left" alt="" width="" height="">
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" pageno="false" format="default"/>).</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 title="" suppress-title="false" align="left" alt="" width="" height="">
        <artwork type="example" xml:space="preserve" name="" align="left" alt="" width="" height="">
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 Section 3.2.6 of <xref target="RFC7230" pageno="false" format="default"/>. Likewise, note the rules for when parameter
values need to be quoted in Section 3.1.1 of <xref target="RFC7231" pageno="false" format="default"/>.</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" numbered="true" toc="default">
      <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" pageno="false" format="default"/>).</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" numbered="true" toc="default">
      <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" target="https://www.rfc-editor.org/info/rfc2119" quote-title="true">
        <front>
          <title>Key words for use in RFCs to Indicate Requirement Levels</title>
          <author initials="S." surname="Bradner" fullname="S. Bradner">
            <organization/>
          </author>
          <date year="1997" month="March"/>
          <abstract>
            <t>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.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="2119"/>
        <seriesInfo name="DOI" value="10.17487/RFC2119"/>
      </reference>
      <reference anchor="RFC7230" target="https://www.rfc-editor.org/info/rfc7230" quote-title="true">
        <front>
          <title>Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing</title>
          <author initials="R." surname="Fielding" fullname="R. Fielding" role="editor">
            <organization/>
          </author>
          <author initials="J." surname="Reschke" fullname="J. Reschke" role="editor">
            <organization/>
          </author>
          <date year="2014" month="June"/>
          <abstract>
            <t>The Hypertext Transfer Protocol (HTTP) is a stateless application-level protocol for distributed, collaborative, hypertext information systems.  This document provides an overview of HTTP architecture and its associated terminology, defines the "http" and "https" Uniform Resource Identifier (URI) schemes, defines the HTTP/1.1 message syntax and parsing requirements, and describes related security concerns for implementations.</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="7230"/>
        <seriesInfo name="DOI" value="10.17487/RFC7230"/>
      </reference>
      <reference anchor="RFC8174" target="https://www.rfc-editor.org/info/rfc8174" quote-title="true">
        <front>
          <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
          <author initials="B." surname="Leiba" fullname="B. Leiba">
            <organization/>
          </author>
          <date year="2017" month="May"/>
          <abstract>
            <t>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.</t>
          </abstract>
        </front>
        <seriesInfo name="BCP" value="14"/>
        <seriesInfo name="RFC" value="8174"/>
        <seriesInfo name="DOI" value="10.17487/RFC8174"/>
      </reference>
      <reference anchor="RFC5234" target="https://www.rfc-editor.org/info/rfc5234" quote-title="true">
        <front>
          <title>Augmented BNF for Syntax Specifications: ABNF</title>
          <author initials="D." surname="Crocker" fullname="D. Crocker" role="editor">
            <organization/>
          </author>
          <author initials="P." surname="Overell" fullname="P. Overell">
            <organization/>
          </author>
          <date year="2008" month="January"/>
          <abstract>
            <t>Internet technical specifications often need to define a formal syntax.  Over the years, a modified version of Backus-Naur Form (BNF), called Augmented BNF (ABNF), has been popular among many Internet specifications.  The current specification documents ABNF. It balances compactness and simplicity with reasonable representational power.  The differences between standard BNF and ABNF involve naming rules, repetition, alternatives, order-independence, and value ranges.  This specification also supplies additional rule definitions and encoding for a core lexical analyzer of the type common to several Internet specifications.  [STANDARDS-TRACK]</t>
          </abstract>
        </front>
        <seriesInfo name="STD" value="68"/>
        <seriesInfo name="RFC" value="5234"/>
        <seriesInfo name="DOI" value="10.17487/RFC5234"/>
      </reference>
      <reference anchor="RFC7231" target="https://www.rfc-editor.org/info/rfc7231" quote-title="true">
        <front>
          <title>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</title>
          <author initials="R." surname="Fielding" fullname="R. Fielding" role="editor">
            <organization/>
          </author>
          <author initials="J." surname="Reschke" fullname="J. Reschke" role="editor">
            <organization/>
          </author>
          <date year="2014" month="June"/>
          <abstract>
            <t>The Hypertext Transfer Protocol (HTTP) is a stateless \%application- level protocol for distributed, collaborative, hypertext information systems.  This document defines the semantics of HTTP/1.1 messages, as expressed by request methods, request header fields, response status codes, and response header fields, along with the payload of messages (metadata and body content) and mechanisms for content negotiation.</t>
          </abstract>
        </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" quote-title="true">
        <front>
          <title>Forwarding-Loop Attacks in Content Delivery Networks</title>
          <author initials="J." surname="Chen" fullname="Jianjun Chen">
            <organization/>
          </author>
          <author initials="J." surname="Jiang" fullname="Jian Jiang">
            <organization/>
          </author>
          <author initials="X." surname="Zheng" fullname="Xiaofeng Zheng">
            <organization/>
          </author>
          <author initials="H." surname="Duan" fullname="Haixin Duan">
            <organization/>
          </author>
          <author initials="J." surname="Liang" fullname="Jinjin Liang">
            <organization/>
          </author>
          <author initials="K." surname="Li" fullname="Kang Li">
            <organization/>
          </author>
          <author initials="T." surname="Wan" fullname="Tao Wan">
            <organization/>
          </author>
          <author initials="V." surname="Paxson" fullname="Vern Paxson">
            <organization/>
          </author>
          <date year="2016" month="February"/>
        </front>
      </reference>

      <reference anchor="RFC4122" target="https://www.rfc-editor.org/info/rfc4122" quote-title="true">
        <front>
          <title>A Universally Unique IDentifier (UUID) URN Namespace</title>
          <author initials="P." surname="Leach" fullname="P. Leach">
            <organization/>
          </author>
          <author initials="M." surname="Mealling" fullname="M. Mealling">
            <organization/>
          </author>
          <author initials="R." surname="Salz" fullname="R. Salz">
            <organization/>
          </author>
          <date year="2005" month="July"/>
          <abstract>
            <t>This specification defines a Uniform Resource Name namespace for UUIDs (Universally Unique IDentifier), also known as GUIDs (Globally Unique IDentifier).  A UUID is 128 bits long, and can guarantee uniqueness across space and time.  UUIDs were originally used in the Apollo Network Computing System and later in the Open Software Foundation\'s (OSF) Distributed Computing Environment (DCE), and then in Microsoft Windows platforms.</t>
            <t>This specification is derived from the DCE specification with the kind permission of the OSF (now known as The Open Group).  Information from earlier versions of the DCE specification have been incorporated into this document.  [STANDARDS-TRACK]</t>
          </abstract>
        </front>
        <seriesInfo name="RFC" value="4122"/>
        <seriesInfo name="DOI" value="10.17487/RFC4122"/>
      </reference>
    </references>
  </back>
</rfc>
