Loop Detection in Content Delivery Networks (CDNs)Akamai Technologiessludin@akamai.comFastlymnot@fastly.comCloudflarenick@cloudflare.com
Applications and Real-Time
HTTPInternet-DraftThis 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.IntroductionIn 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.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.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.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 ), especially if one CDN unintentionally strips the loop detection headers of another.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.Relationship to ViaHTTP defines the Via header field in for "tracking message forwards, avoiding request loops, and identifying the protocol capabilities of senders along the request/response chain."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.Conventions and DefinitionsThe key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 when, and only when, they appear in all capitals, as shown here.This specification uses the Augmented Backus-Naur Form (ABNF) notation of with a list extension, defined in , 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 and the parameter rule from .The CDN-Loop Request Header FieldThe 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.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 ).Optionally, cdn-info can have semicolon-separated key/value parameters to accommodate additional information for the CDN's use.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).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.For example:Note that the pseudonym syntax does not allow whitespace, DQUOTE, or any of the characters "(),/:;<=>?@[]{}". See . Likewise, note the rules for when parameter values need to be quoted in .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.Security ConsiderationsThe 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 ).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.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.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).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.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.IANA ConsiderationsThis document registers the "CDN-Loop" header field in the "Permanent Message Header Field Names" registry.Header Field Name: CDN-LoopProtocol: httpStatus: standardReference: RFC 8586Key words for use in RFCs to Indicate Requirement LevelsHypertext Transfer Protocol (HTTP/1.1): Message Syntax and RoutingAmbiguity of Uppercase vs Lowercase in RFC 2119 Key WordsAugmented BNF for Syntax Specifications: ABNFHypertext Transfer Protocol (HTTP/1.1): Semantics and ContentForwarding-Loop Attacks in Content Delivery NetworksA Universally Unique IDentifier (UUID) URN Namespace