<?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" category="std" docName="draft-siloniz-cdni-edge-control-metadata-00" updates="8006" ipr="trust200902" version="3">
  <!-- xml2rfc v2v3 conversion 3.16.0 -->
  <front>
    <title abbrev="CDNI Edge Control Metadata">CDNI Edge Control Metadata</title>
    <seriesInfo name="Internet-Draft" value="draft-siloniz-cdni-edge-control-metadata-00"/>
    <author initials="A." surname="Siloniz" fullname="Alfonso Siloniz">
      <organization>Telefonica</organization>
      <address>
        <postal>
          <street/>
          <city/>
          <region/>
          <code/>
          <country>Spain</country>
        </postal>
        <email>alfonsosiloniz@gmail.com</email>
      </address>
    </author>
    <author fullname="Glenn Goldstein" initials="G." surname="Goldstein">
      <organization>Lumen Technologies</organization>
      <address>
        <postal>
          <street/>
          <city/>
          <region/>
          <code/>
          <country>US</country>
        </postal>
        <email>glenng1215@gmail.com</email>
      </address>
    </author>
    <date/>
    <abstract>
      <t>
            This specification defines MI configuration metadata objects to extend RFC 8006 related to controlling edge access to resources via CDNs and  Open Caching systems. Configuring Cross-Origin Resource Sharing (CORS) access rules and the dynamic generation of CORS headers is a key feature of typical configurations, as are the ability to define response body compression rules, client connection timeouts, and traffic type hints for optimized caching.
      </t>
    </abstract>
  </front>
  <middle>
    <section anchor="INTRODUCTION">
      <name>Introduction</name>
      <t>CDNs typically require a set of configuration metadata to inform processing of responses downstream (at the edge and in the user agent). This section specifies GenericMetadata objects to meet those requirements, defining edge processing rules such as CORS handling, response compressions,  and client connection failures.</t>
    </section>
    <section anchor="requirements">
      <name>Requirements</name>
      <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in <xref target="RFC2119"/>.</t>
    </section>
    <section anchor="MI.CrossoriginPolicy">
      <name>MI.CrossoriginPolicy</name>
      <t>Delegation of traffic between a CDN over an open caching node based on HTTP redirection does change the domain name in the client requests. This represents a cross-origin request that must be managed appropriately using Cross-Origin Resource Sharing (CORS) headers in the responses.</t>
      <t>The dynamic generation of CORS headers is typical in modern HTTP request processing and avoids CORS validation forwarded to the CDN origin servers, particularly with the preflight OPTIONS requests. The CDNI metadata model requires extensions to specify how a CDN or open caching node should generate and evaluate these headers.</t>
      <t>Required capabilities:</t>
      <t>Set a default value for CORS response headers independent of the origin request header value.</t>
      <ol spacing="normal" type="1"><li>Set a default value for CORS response headers independent of the origin request header value.</li>
        <li>Match the origin request header with a list of valid values, including PatternMatch, to return or not return the CORS response headers. </li>
        <li>Set a list of custom headers that can be exposed to the client (expose headers).</li>
        <li>Support for preflight requests using the OPTIONS method, including custom header validation, expose headers, and methods.</li>
        <li>Support for credentials validation within CORS.</li>
      </ol>
      <t>Simple CORS requests are those where both HTTP method and headers in the request are included in the safe list defined by the World Wide Web Consortium <xref target="W3C"/>. The user agent (UA) request can include an origin header set to the URL domain of the webpage that the player runs. Depending on the metadata configuration, the logic to apply by the open caching node (OCN) is:</t>
      <t>Validation of the origin header - Metadata can include a list of valid domains to validate the request origin header. If it does not match, the CORS header must not be included in the response.</t>
      <ol spacing="normal" type="1"><li>Validation of the origin header - Metadata can include a list of valid domains to validate the request origin header. If it does not match, the CORS header must not be included in the response.</li>
        <li>WIldcard usage - Depending on the configuration, the resultant CORS header to include in the response will be the same as the request origin header, or a wildcard.</li>
        <li>If no validation of request is included in the origin header, set a default value for CORS response headers independent of the origin request header value.</li>
      </ol>
      <t>When a UA makes a request that includes a method or headers that are not included in the safe-list, the client will make a CORS preflight request using the OPTIONS method to the resource including the origin header. If CORS is enabled and the requests passes the origin validation, the OCN SHOULD respond with the set of headers that indicate what is permitted for that resource, including one or more of the following:</t>
      <t>Allowed methods</t>
      <ol spacing="normal" type="1"><li>Allowed methods</li>
        <li>Allowed credentials</li>
        <li>Allowed request headers</li>
        <li>Max age that the OPTIONS request is valid</li>
        <li>Headers that can be exposed to the client</li>
      </ol>
      <t>When an uCDN configures any of those advanced parameters it is requesting the dCDN to generate synthetic responses to OPTIONS requests. Thus, no conditional request is performed to the uCDN origin. uCDN should configure these values taking that into account. If some of the advanced parameters are empty, the dCDN would not send the corresponding header into the UA OPTIONS request.</t>
      <t>In case the uCDN only configures the MI.AccessControlAllowOrigin subobject, the dCDN will not generate synthetic responses to OPTIONS requests, thus it will validate we the uCDN every OPTIONS request to obtain the response.  </t>
      <t>CrossoriginPolicy is a GenericMetadata object that allows for the specification of dynamically generated CORS headers.</t>
      <ul empty="true" spacing="normal">
        <li>
          <t>Property: allow-origin</t>
          <ul spacing="normal">
            <li>Description: Validation of simple CORS requests.</li>
            <li>Type: Object MI.AccessControlAllowOrigin</li>
            <li>Mandatory-to-Specify: Yes</li>
          </ul>
        </li>
        <li>
          <t>Property: expose-headers</t>
          <ul spacing="normal">
            <li>Description: A list of values the OCN will include in the Access-Control-Expose-Headers response header to a preflight request.</li>
            <li>Type: Array of strings</li>
            <li>Mandatory-to-Specify: No</li>
          </ul>
        </li>
        <li>
          <t>Property: allow-methods</t>
          <ul spacing="normal">
            <li>Description: A list of values the OCN will include in the Access-Control-Allow-Methods response header to a preflight request.</li>
            <li>Type: Array of strings</li>
            <li>Mandatory-to-Specify: No</li>
          </ul>
        </li>
        <li>
          <t>Property: allow-headers</t>
          <ul spacing="normal">
            <li>Description: A list of values the OCN will include in the Access-Control-Allow-Headers response header to a preflight request.</li>
            <li>Type: Array of strings</li>
            <li>Mandatory-to-Specify: No</li>
          </ul>
        </li>
        <li>
          <t>Property: allow-credentials</t>
          <ul spacing="normal">
            <li>Description: The value the OCN will include in the Access-Control-Allow-Credentials response header to a preflight request.</li>
            <li>Type: Boolean</li>
            <li>Mandatory-to-Specify: No</li>
          </ul>
        </li>
        <li>
          <t>Property: max-age</t>
          <ul spacing="normal">
            <li>Description: The value the OCN will include in the Access-Control-Max-Age response header to a preflight request.</li>
            <li>Type: Integer</li>
            <li>Mandatory-to-Specify: No</li>
          </ul>
        </li>
        <li>
          <t>Property: no-origin-response-headers</t>
          <ul spacing="normal">
            <li>Description: In the case of a request that has no Origin field, return this set of headers with the response.</li>
            <li>Type: Array of MI.HTTPHeader</li>
            <li>Mandatory-to-Specify: No</li>
          </ul>
        </li>
        <li>
          <t>Property: apply-to-all-methods</t>
          <ul spacing="normal">
            <li>Description: By default the CORS configuration refers to OPTIONS requests. Setting this flag to true applies the entire CORS configuration to the other methods as well</li>
            <li>Type: Bollean</li>
            <li>Default:  false</li>
            <li>Mandatory-to-Specify: No</li>
          </ul>
        </li>
      </ul>
      <section anchor="MI.AccessControlAllowOrigin">
        <name>MI.AccessControlAllowOrigin</name>
        <t>The MI.AccessControlAllowOrigin object has the following properties:</t>
        <ul empty="true" spacing="normal">
          <li>
            <t>Property: allow-list</t>
            <ul spacing="normal">
              <li>Description: List of valid URLs that will be used to match the request origin header. The Origin header is a HTTP extension. Its value is a version of the Referer header in some specific requests, and used for Cross Origin requests. . Permitted values are schema://hostname[:port] </li>
              <li>Type: Array of PatternMatch objects</li>
              <li>Mandatory-to-Specify: Yes</li>
            </ul>
          </li>
          <li>
            <t>Property: wildcard-return</t>
            <ul spacing="normal">
              <li>Description: If "True", the OCN will include a wildcard (*) in the Access-Control-Allow-Origin response header. If "False", the OCN will reflect the request origin header in the Access-Control-Allow-Origin response header.</li>
              <li>Type: Boolean</li>
              <li>Mandatory-to-Specify: Yes</li>
            </ul>
          </li>
        </ul>
        <t>The examples below demonstrate how to configure response headers dynamically for CORS validation.</t>
        <t>Example 1: A simple CORS validation configuration:</t>
        <artwork><![CDATA[{
  "generic-metadata-type": "MI.CrossoriginPolicy",
  "generic-metadata-value": {
    "allow-origin": {
      "allow-list": [
        {
          "pattern": "*"
        }
      ],
      "wildcard-return": true
    }
  }
}
]]></artwork>
        <t> </t>
        <t>Example 2: Validation of a preflight request when some of the headers included in the subsequent object request are not included in the CORS specification safelist:</t>
        <artwork><![CDATA[{
  "generic-metadata-type": "MI.CrossoriginPolicy",
  "generic-metadata-value": {
    "allow-origin": {
      "allow-list": [
        {
          "pattern": "*://sourcepage.example.com"
        },
        "wildcard-return": false
      },
      "allow-methods": [ "GET", "POST" ],
      "allow-credentials": true,
      "allow-headers": [ "X-PINGOTHER", "Content-Type" ],
      "expose-headers": [ "X-User", "Authorization" ],
      "max-age": 3600
    }
  }
}
]]></artwork>
      </section>
    </section>
    <section anchor="MI.AllowCompress">
      <name>MI.AllowCompress</name>
      <t>Downstream CDNs often have the ability to compress HTTP response bodies in cases where the client has declared that it can accept compressed responses (via an Accept-Encoding header), but the source/origin has returned an uncompressed response.</t>
      <t>The specific compression algorithm used by the dCDN is negotiated by the client’s Accept-Encoding header according to <xref target="RFC9110"/> (including q= preferences) and the compression capabilities available on the dCDN. </t>
      <t>In addition, HeaderTransform allows the uCDN to normalize, or modify, the Accept-Encoding header to allow for fine-grain control over the selection of the compression algorithm (e.g., gzip, compress, deflate, br, etc.).</t>
      <t>AllowCompress is a new GenericMetadata object that allows the dCDN to compress content before sending to the client.</t>
      <ul empty="true" spacing="normal">
        <li>
          <t>Property: allow-compress</t>
          <ul spacing="normal">
            <li>Description:  If set to "True", then the dCDN will try to compress the response to the client based on the Accept-Encoding request header.</li>
            <li>Type: Boolean</li>
            <li>Values: True or False</li>
            <li>Mandatory-to-Specify: No. The default is "False".</li>
          </ul>
        </li>
      </ul>
      <t>The following examples illustrate the use of MI.AllowCompress in the context of the Processing Stages model that allowed for metadata to be applied conditionally based on evaluation of HTTP request headers. See the Processing Stages Metadata Specification and Metadata Model Expression Language (MEL) Specification.</t>
      <t>Example 1: An MI.AllowCompress that allows manifests (*.m3u8) to be compressed by the dCDN:</t>
      <artwork><![CDATA[{
  "match": {
    "expression": "req.h.uri *= '*.m3u8'"
  },
  "stage-metadata": {
    "generic-metadata": [
      {
        "generic-metadata-type": "MI.AllowCompress",
        "generic-metadata-value": {
          "allow-compress": "true"
        }
      }
    ]
  }
}
]]></artwork>
      <t>Example 2: An MI.AllowCompress that allows manifests (*.m3u8) to be compressed by the dCDN but normalizing the client’s Accept-Encoding header:</t>
      <artwork><![CDATA[{
  "match": {
    "expression": "req.h.accept-encoding *= '*gzip*'"
  },
  "stage-metadata": {
    "generic-metadata": [
      {
        "generic-metadata-type": "MI.AllowCompress",
        "generic-metadata-value": {
          "allow-compress": "true"
        }
      }
    ]
  }
}
]]></artwork>
    </section>
    <section anchor="MI.ClientConnectionControl">
      <name>MI.ClientConnectionControl</name>
      <t>Configuration metadata is required to define how connections against a client are maintained by a dCDN. Since the clients are typically owned/operated by a uCDN, giving this control to a uCDN allows it to accommodate device specific constraints and performance optimizations. A dCDN can also benefit from this configuration metadata to meet its security and resource consumption requirements.</t>
      <t>ClientConnectionControl is a new GenericMetadata object that specifies how a dCDN manages its connections to clients/players.</t>
      <ul empty="true" spacing="normal">
        <li>
          <t>Property: connection-keep-alive-time-ms</t>
          <ul spacing="normal">
            <li>Description: Specifies the time in milliseconds to keep an idle connection open.</li>
            <li>Type: Integer</li>
            <li>Mandatory-to-Specify: No. When not specified, a default value selected by the dCDN will be used.</li>
          </ul>
        </li>
      </ul>
      <t>Following example shows how a connection setup and keep alive timeout can be set for client connections against a dCDN:</t>
      <artwork><![CDATA[  {
    "generic-metadata-type": "MI.ClientConnectionControl",
    "generic-metadata-value": {
      "connection-keep-alive-time-ms": 3
    }
  }
]]></artwork>
    </section>
    <section anchor="MI.TrafficType">
      <name>MI.TrafficType</name>
      <t>Content delivery networks often apply different infrastructure, network routes, and internal metadata for different types of traffic. Delivery of large static objects (such as software downloads), may, for example, use different edge servers and network routes than video stream delivery. In an HTTP adaptive bitrate video service, every video title corresponds to a set of video files and descriptors according to different video protocols, and this is independent of the type of service (Video-on-Demand, Live, Catch-up, etc.).</t>
      <t>The way the video service is consumed by the user agents can vary. For instance, a segment that belongs to a Video-on-Demand (VoD) title can be requested for every moment the content is available for the user agents to consume, while a segment of live content will be only requested as long as the time-shift duration is configured for that service. Knowing those differences, a CDN or OCN provider can implement specific strategies that will maximize performance and thereby provide more available capacity to the upstream provider. It should be noted that the dCDNs handling of the traffic types is implementation-specific and not prescribed here.</t>
      <t>MI.TrafficType metadata defines a set of descriptors that characterize either the type or usage of the traffic, enabling CDNs and OCNs to apply any internal configuration rules without exposing an unnecessary number of internal details. Note that the interpretation of these traffic types and application of rules such as rate limiting or delivery pacing are implementation specific.</t>
      <ul empty="true" spacing="normal">
        <li>
          <t>Property: traffic-type</t>
          <ul spacing="normal">
            <li>Description: A literal that defines the traffic type. uCDN will use the literal that is most representative of the traffic being delegated. </li>
            <li>Type: Enumeration [vod, live, object-download] encoded as lowercase string</li>
            <li>Mandatory-to-Specify: Yes</li>
          </ul>
        </li>
        <li>
          <t>Property: hints</t>
          <ul spacing="normal">
            <li>Description: Other traffic characteristics that the uCDN can indicate to the dCDN as suggestions for service optimization. Accepts free-form unconstrained values.</li>
            <li>Type: Array of strings</li>
            <li>Mandatory-to-Specify: No</li>
          </ul>
        </li>
      </ul>
      <t>A TrafficType definition example for HostMetadata:</t>
      <artwork><![CDATA[{
  "generic-metadata-type": "MI.TrafficType",
  "generic-metadata-value": {
    "traffic-type": "vod",
    "hints": [ "low-latency", "catch-up" ]
  }
}
]]></artwork>
    </section>
    <section anchor="CONCLUSION">
      <name>Conclusion</name>
      <t>The specification has extended the basic CDNI configuration metadata objects defined in <xref target="RFC8006"/>, and can be extended in the future with additional Edge Control Metadata object definitions.</t>
    </section>
    <section anchor="Security">
      <name>Security Considerations</name>
      <t>
            The FCI and MI objects defined in the present document are
   transferred via the interfaces defined in CDNI <xref target="RFC8006"/>. <xref target="RFC8006"/>
   describes how to secure these interfaces, protecting the integrity,
   confidentiality and ensuring the authenticity of the dCDN and uCDN.
   The security provide by <xref target="RFC8006"/> should therefore address the above
   security concerns.
      </t>
    </section>
    <section anchor="IANA">
      <name>IANA Considerations</name>
      <section anchor="IANA.cdni.payload.types">
        <name>CDNI Payload Types</name>
        <t>
                    TBD.
        </t>
      </section>
    </section>
    <section anchor="Acknowledgements">
      <name>Acknowledgements</name>
      <t>
                The authors would like to express their gratitude to the members of the Streaming Video Technology Alliance <xref target="SVTA"/> Open Caching Working Group for their guidance / contribution / reviews ...)
      </t>
      <t>
                Particulary the following people contribute in one or other way to the content of this draft:
      </t>
      <ul empty="true" spacing="normal">
        <li>Guillaume Bichot - Broadpeak </li>
        <li>Christoph Neumann - Broadpeak </li>
        <li>Pankaj Chaudhari - Disney Streaming Services</li>
        <li>Rajeev RK - picoNETS</li>
        <li>Yoav Gressel - Qwilt</li>
        <li>Arnon Warshavsky - QWilt</li>
        <li>Shmuel Asafi  . Qwilt</li>
        <li>Nir Sopher - Qwilt</li>
        <li>Arnon Warshavsky - Qwilt</li>
        <li>Ben Rosenblum - Vecima</li>
      </ul>
    </section>
  </middle>
  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <reference anchor="RFC9110" target="https://www.rfc-editor.org/info/rfc9110" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9110.xml">
          <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"/>
            <abstract>
              <t>The Hypertext Transfer Protocol (HTTP) is a stateless application-level protocol for distributed, collaborative, hypertext information systems. This document describes the overall architecture of HTTP, establishes common terminology, and defines aspects of the protocol that are shared by all versions. In this definition are core protocol elements, extensibility mechanisms, and the "http" and "https" Uniform Resource Identifier (URI) schemes.</t>
              <t>This document updates RFC 3864 and obsoletes RFCs 2818, 7231, 7232, 7233, 7235, 7538, 7615, 7694, and portions of 7230.</t>
            </abstract>
          </front>
          <seriesInfo name="STD" value="97"/>
          <seriesInfo name="RFC" value="9110"/>
          <seriesInfo name="DOI" value="10.17487/RFC9110"/>
        </reference>
        <reference anchor="RFC8006" target="https://www.rfc-editor.org/info/rfc8006" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8006.xml">
          <front>
            <title>Content Delivery Network Interconnection (CDNI) Metadata</title>
            <author fullname="B. Niven-Jenkins" initials="B." surname="Niven-Jenkins"/>
            <author fullname="R. Murray" initials="R." surname="Murray"/>
            <author fullname="M. Caulfield" initials="M." surname="Caulfield"/>
            <author fullname="K. Ma" initials="K." surname="Ma"/>
            <date month="December" year="2016"/>
            <abstract>
              <t>The Content Delivery Network Interconnection (CDNI) Metadata interface enables interconnected Content Delivery Networks (CDNs) to exchange content distribution metadata in order to enable content acquisition and delivery.  The CDNI Metadata associated with a piece of content provides a downstream CDN with sufficient information for the downstream CDN to service content requests on behalf of an upstream CDN.  This document describes both a base set of CDNI Metadata and the protocol for exchanging that metadata.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="8006"/>
          <seriesInfo name="DOI" value="10.17487/RFC8006"/>
        </reference>
        <reference anchor="RFC2119" target="https://www.rfc-editor.org/info/rfc2119" xml:base="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml">
          <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"/>
            <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>
      </references>
      <references>
        <name>Informative References</name>
        <reference anchor="W3C" target="https://www.w3.org/TR/2020/SPSD-cors-20200602/">
          <front>
            <title>Cross-Origin Resource Sharing</title>
            <author/>
            <date/>
          </front>
        </reference>
        <reference anchor="SVTA" target="https://www.svta.org">
          <front>
            <title>Streaming Video Technology Alliance Home Page</title>
            <author/>
            <date/>
          </front>
        </reference>
      </references>
    </references>
  </back>
</rfc>
