<?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.0.30 -->

<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
]>

<?rfc toc="yes"?>
<?rfc tocindent="yes"?>
<?rfc sortrefs="yes"?>
<?rfc symrefs="yes"?>
<?rfc strict="yes"?>
<?rfc compact="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>

<rfc ipr="trust200902" docName="draft-ietf-httpbis-origin-frame-02" category="std">

  <feedback xmlns='http://purl.org/net/xml2rfc/ext' template="mailto:ietf-http-wg@w3.org?subject={docname},%20%22{section}%22&amp;body=%3c{ref}%3e:"/><front>
    <title abbrev="ORIGIN Frames">The ORIGIN HTTP/2 Frame</title>

    <author initials="M." surname="Nottingham" fullname="Mark Nottingham">
      <organization>Akamai</organization>
      <address>
        <email>mnot@mnot.net</email>
        <uri>https://www.mnot.net/</uri>
      </address>
    </author>
    <author initials="E." surname="Nygren" fullname="Erik Nygren">
      <organization>Akamai</organization>
      <address>
        <email>nygren@akamai.com</email>
      </address>
    </author>

    <date year="2017" month="2" day="13"/>

    <area>General</area>
    <workgroup>HTTP</workgroup>
    <keyword>Internet-Draft</keyword>

    <abstract>


<t>This document specifies the ORIGIN frame for HTTP/2, to indicate what origins are available on a
given connection.</t>



    </abstract>


    <note title="Note to Readers">


<t>Discussion of this draft takes place on the HTTP working group mailing list 
(ietf-http-wg@w3.org), which is archived at <eref target="https://lists.w3.org/Archives/Public/ietf-http-wg/">https://lists.w3.org/Archives/Public/ietf-http-wg/</eref>.</t>

<t>Working Group information can be found at <eref target="http://httpwg.github.io/">http://httpwg.github.io/</eref>; source 
code and issues list for this draft can be found at <eref target="https://github.com/httpwg/http-extensions/labels/origin-frame">https://github.com/httpwg/http-extensions/labels/origin-frame</eref>.</t>


    </note>


  </front>

  <middle>


<section anchor="introduction" title="Introduction">

<t>HTTP/2 <xref target="RFC7540"/> allows clients to coalesce different origins <xref target="RFC6454"/> onto the same
connection when certain conditions are met. However, in certain cases, a connection is is not
usable for a coalesced origin, so the 421 (Misdirected Request) status code (<xref target="RFC7540"/>, Section
9.1.2) was defined.</t>

<t>Using a status code in this manner allows clients to recover from misdirected requests, but at the
penalty of adding latency. To address that, this specification defines a new HTTP/2 frame type,
“ORIGIN”, to allow servers to indicate what origins a connection is usable for.</t>

<t>Additionally, experience has shown that HTTP/2’s requirement to establish server authority using
both DNS and the server’s certificate is onerous. This specification relaxes the requirement to
check DNS when the ORIGIN frame is in use. Doing so has additional benefits, such as removing the
latency associated with some DNS lookups, and improving DNS privacy.</t>

<section anchor="notational-conventions" title="Notational Conventions">

<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>
<section anchor="the-origin-http2-frame" title="The ORIGIN HTTP/2 Frame">

<t>The ORIGIN HTTP/2 frame (<xref target="RFC7540"/>, Section 4) allows a server to indicate what origin(s)
<xref target="RFC6454"/> the server would like the client to consider as members of the Origin Set (<xref target="set"/>)
for the connection it occurs within.</t>

<section anchor="syntax" title="Syntax">

<t>The ORIGIN frame type is 0xb (decimal 11).</t>

<figure><artwork><![CDATA[
+-------------------------------+-------------------------------+
|         Origin-Len (16)       | ASCII-Origin? (*)           ...
+-------------------------------+-------------------------------+
]]></artwork></figure>

<t>The ORIGIN frame’s payload contains the following fields, sets of which may be repeated within the
frame to indicate multiple origins:</t>

<t><list style="hanging">
  <t hangText='Origin-Len:'>
  An unsigned, 16-bit integer indicating the length, in octets, of the ASCII-Origin field.</t>
  <t hangText='Origin:'>
  An optional sequence of characters containing the ASCII serialization of an origin (<xref target="RFC6454"/>, Section 6.2) that the sender believes this connection is or could be authoritative for.</t>
</list></t>

<t>The ORIGIN frame does not define any flags. However, future updates to this specification MAY
define flags. See <xref target="process"/>.</t>

</section>
<section anchor="process" title="Processing ORIGIN Frames">

<t>The ORIGIN frame is a non-critical extension to HTTP/2. Endpoints that do not support this frame
can safely ignore it upon receipt.</t>

<t>When received by an implementing client, it is used to initialise and manipulate the Origin Set
(see <xref target="set"/>), thereby changing how the client establishes authority for origin servers (see
<xref target="authority"/>).</t>

<t>The origin frame MUST be sent on stream 0; an ORIGIN frame on any other stream is invalid and MUST
be ignored.</t>

<t>Likewise, the ORIGIN frame is only valid on connections with the “h2” protocol identifier, or when
specifically nominated by the protocol’s definition; it MUST be ignored when received on a
connection with the “h2c” protocol identifier.</t>

<t>This specification does not define any flags for the ORIGIN frame, but future updates might use
them to change its semantics. The first four flags (0x1, 0x2, 0x4 and 0x8) are reserved for
backwards-incompatible changes, and therefore when any of them are set, the ORIGIN frame containing
them MUST be ignored by clients conforming to this specification. The remaining flags are reserved
for backwards-compatible changes, and do not affect processing by clients conformant to this
specification.</t>

<t>The ORIGIN frame describes a property of the connection, and therefore is processed hop-by-hop. An
intermediary MUST NOT forward ORIGIN frames. Clients configured to use a proxy MUST ignore any
ORIGIN frames received from it.</t>

<t>Each ASCII-Origin field in the frame’s payload MUST be parsed as an ASCII serialisation of an
origin (<xref target="RFC6454"/>, Section 6.2). If parsing fails, the field MUST be ignored.</t>

<t>See <xref target="algo"/> for an illustrative algorithm for processing ORIGIN frames.</t>

</section>
<section anchor="set" title="The Origin Set">

<t>The set of origins (as per <xref target="RFC6454"/>) that a given connection might be used for is known in this
specification as the Origin Set.</t>

<t>By default, a connections’s Origin Set is uninitialised. When an ORIGIN frame is first received and
successfully processed by a client, the connection’s Origin Set is defined to contain a single
origin, composed from:</t>

<t><list style="symbols">
  <t>Scheme: “https”</t>
  <t>Host: the value sent in Server Name Indication (<xref target="RFC6066"/> Section 3), converted to lower case</t>
  <t>Port: the remote port of the connection (i.e., the server’s port)</t>
</list></t>

<t>The contents of that ORIGIN frame (and subsequent ones) allows the server to incrementally add new
origins to the Origin Set, as described in <xref target="process"/>.</t>

<t>The Origin Set is also affected by the 421 (Misdirected Request) response status code, defined in
<xref target="RFC7540"/> Section 9.1.2. Upon receipt of a response with this status code, implementing clients
MUST create the ASCII serialisation of the corresponding request’s origin (as per <xref target="RFC6454"/>,
Section 6.2) and remove it from the connection’s Origin Set, if present.</t>

</section>
<section anchor="authority" title="Authority, Push and Coalescing with ORIGIN">

<t><xref target="RFC7540"/>, Section 10.1 uses both DNS and the presented TLS certificate to establish the origin
server(s) that a connection is authoritative for, just as HTTP/1.1 does in <xref target="RFC7230"/>.
Furthermore, <xref target="RFC7540"/> Section 9.1.1 explicitly allows a connection to be used for more than one
origin server, if it is authoritative. This affects what requests can be sent on the connection,
both in HEADERS frame by the client and as PUSH_PROMISE frames from the server.</t>

<t>Once an Origin Set has been initialised for a connection, clients that implement this specification
change these behaviors in the following ways:</t>

<t><list style="symbols">
  <t>Clients MUST NOT consult DNS to establish the connection’s authority for new requests. The TLS
certificate MUST stil be used to do so, as described in <xref target="RFC7540"/> Section 9.1.1.</t>
  <t>Clients sending a new request SHOULD use an existing connection if the request’s origin is in that connection’s Origin Set, unless there are operational reasons for creating a new connection.</t>
  <t>Clients MUST use the Origin Set to determine whether a received PUSH_PROMISE is authoritative, as described in <xref target="RFC7540"/>, Section 8.2.2.</t>
</list></t>

<t>Note that clients are still required to perform checks on the certificate presented by the server
for each origin that a connection is used for; see <xref target="RFC7540"/> Section 9.1.1 for more information.
This includes verifying that the host matches a <spanx style="verb">dNSName</spanx> value from the certificate
<spanx style="verb">subjectAltName</spanx> field (using the wildcard rules defined in <xref target="RFC2818"/>; see also <xref target="RFC5280"/>
Section 4.2.1.6).</t>

<t>Because ORIGIN can change the set of origins a connection is used for over time, it is possible
that a client might have more than one viable connection to an origin open at any time. When this
occurs, clients SHOULD not emit new requests on any connection whose Origin Set is a subset of
another connection’s Origin Set, and SHOULD close it once all outstanding requests are satisfied.</t>

</section>
</section>
<section anchor="iana-considerations" title="IANA Considerations">

<t>This specification adds an entry to the “HTTP/2 Frame Type” registry.</t>

<t><list style="symbols">
  <t>Frame Type: ORIGIN</t>
  <t>Code: 0xb</t>
  <t>Specification: [this document]</t>
</list></t>

</section>
<section anchor="security-considerations" title="Security Considerations">

<t>Clients that blindly trust the ORIGIN frame’s contents will be vulnerable to a large number of
attacks. See <xref target="authority"/> for mitigations.</t>

<t>Relaxing the requirement to consult DNS when determining authority for an origin means that an
attacker who possesses a valid certificate no longer needs to be on-path to redirect traffic to
them; instead of modifying DNS, they need only convince the user to visit another Web site, in
order to coalesce connections to the target onto their existing connection.</t>

</section>


  </middle>

  <back>

    <references title='Normative References'>





<reference  anchor='RFC2119' target='http://www.rfc-editor.org/info/rfc2119'>
<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='RFC7540' target='http://www.rfc-editor.org/info/rfc7540'>
<front>
<title>Hypertext Transfer Protocol Version 2 (HTTP/2)</title>
<author initials='M.' surname='Belshe' fullname='M. Belshe'><organization /></author>
<author initials='R.' surname='Peon' fullname='R. Peon'><organization /></author>
<author initials='M.' surname='Thomson' fullname='M. Thomson' role='editor'><organization /></author>
<date year='2015' month='May' />
<abstract><t>This specification describes an optimized expression of the semantics of the Hypertext Transfer Protocol (HTTP), referred to as HTTP version 2 (HTTP/2).  HTTP/2 enables a more efficient use of network resources and a reduced perception of latency by introducing header field compression and allowing multiple concurrent exchanges on the same connection.  It also introduces unsolicited push of representations from servers to clients.</t><t>This specification is an alternative to, but does not obsolete, the HTTP/1.1 message syntax.  HTTP's existing semantics remain unchanged.</t></abstract>
</front>
<seriesInfo name='RFC' value='7540'/>
<seriesInfo name='DOI' value='10.17487/RFC7540'/>
</reference>



<reference  anchor='RFC6454' target='http://www.rfc-editor.org/info/rfc6454'>
<front>
<title>The Web Origin Concept</title>
<author initials='A.' surname='Barth' fullname='A. Barth'><organization /></author>
<date year='2011' month='December' />
<abstract><t>This document defines the concept of an &quot;origin&quot;, which is often used as the scope of authority or privilege by user agents.  Typically, user agents isolate content retrieved from different origins to prevent malicious web site operators from interfering with the operation of benign web sites.  In addition to outlining the principles that underlie the concept of origin, this document details how to determine the origin of a URI and how to serialize an origin into a string.  It also defines an HTTP header field, named &quot;Origin&quot;, that indicates which origins are associated with an HTTP request.   [STANDARDS-TRACK]</t></abstract>
</front>
<seriesInfo name='RFC' value='6454'/>
<seriesInfo name='DOI' value='10.17487/RFC6454'/>
</reference>



<reference  anchor='RFC6066' target='http://www.rfc-editor.org/info/rfc6066'>
<front>
<title>Transport Layer Security (TLS) Extensions: Extension Definitions</title>
<author initials='D.' surname='Eastlake 3rd' fullname='D. Eastlake 3rd'><organization /></author>
<date year='2011' month='January' />
<abstract><t>This document provides specifications for existing TLS extensions.  It is a companion document for RFC 5246, &quot;The Transport Layer Security (TLS) Protocol Version 1.2&quot;.  The extensions specified are server_name, max_fragment_length, client_certificate_url, trusted_ca_keys, truncated_hmac, and status_request.  [STANDARDS-TRACK]</t></abstract>
</front>
<seriesInfo name='RFC' value='6066'/>
<seriesInfo name='DOI' value='10.17487/RFC6066'/>
</reference>



<reference  anchor='RFC2818' target='http://www.rfc-editor.org/info/rfc2818'>
<front>
<title>HTTP Over TLS</title>
<author initials='E.' surname='Rescorla' fullname='E. Rescorla'><organization /></author>
<date year='2000' month='May' />
<abstract><t>This memo describes how to use Transport Layer Security (TLS) to secure Hypertext Transfer Protocol (HTTP) connections over the Internet.  This memo provides information for the Internet community.</t></abstract>
</front>
<seriesInfo name='RFC' value='2818'/>
<seriesInfo name='DOI' value='10.17487/RFC2818'/>
</reference>



<reference  anchor='RFC5280' target='http://www.rfc-editor.org/info/rfc5280'>
<front>
<title>Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile</title>
<author initials='D.' surname='Cooper' fullname='D. Cooper'><organization /></author>
<author initials='S.' surname='Santesson' fullname='S. Santesson'><organization /></author>
<author initials='S.' surname='Farrell' fullname='S. Farrell'><organization /></author>
<author initials='S.' surname='Boeyen' fullname='S. Boeyen'><organization /></author>
<author initials='R.' surname='Housley' fullname='R. Housley'><organization /></author>
<author initials='W.' surname='Polk' fullname='W. Polk'><organization /></author>
<date year='2008' month='May' />
<abstract><t>This memo profiles the X.509 v3 certificate and X.509 v2 certificate revocation list (CRL) for use in the Internet.  An overview of this approach and model is provided as an introduction.  The X.509 v3 certificate format is described in detail, with additional information regarding the format and semantics of Internet name forms.  Standard certificate extensions are described and two Internet-specific extensions are defined.  A set of required certificate extensions is specified.  The X.509 v2 CRL format is described in detail along with standard and Internet-specific extensions.  An algorithm for X.509 certification path validation is described.  An ASN.1 module and examples are provided in the appendices.  [STANDARDS-TRACK]</t></abstract>
</front>
<seriesInfo name='RFC' value='5280'/>
<seriesInfo name='DOI' value='10.17487/RFC5280'/>
</reference>




    </references>

    <references title='Informative References'>





<reference  anchor='RFC7230' target='http://www.rfc-editor.org/info/rfc7230'>
<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 &quot;http&quot; and &quot;https&quot; 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='RFC5988' target='http://www.rfc-editor.org/info/rfc5988'>
<front>
<title>Web Linking</title>
<author initials='M.' surname='Nottingham' fullname='M. Nottingham'><organization /></author>
<date year='2010' month='October' />
<abstract><t>This document specifies relation types for Web links, and defines a registry for them.  It also defines the use of such links in HTTP headers with the Link header field.  [STANDARDS-TRACK]</t></abstract>
</front>
<seriesInfo name='RFC' value='5988'/>
<seriesInfo name='DOI' value='10.17487/RFC5988'/>
</reference>



<reference  anchor='RFC7838' target='http://www.rfc-editor.org/info/rfc7838'>
<front>
<title>HTTP Alternative Services</title>
<author initials='M.' surname='Nottingham' fullname='M. Nottingham'><organization /></author>
<author initials='P.' surname='McManus' fullname='P. McManus'><organization /></author>
<author initials='J.' surname='Reschke' fullname='J. Reschke'><organization /></author>
<date year='2016' month='April' />
<abstract><t>This document specifies &quot;Alternative Services&quot; for HTTP, which allow an origin's resources to be authoritatively available at a separate network location, possibly accessed with a different protocol configuration.</t></abstract>
</front>
<seriesInfo name='RFC' value='7838'/>
<seriesInfo name='DOI' value='10.17487/RFC7838'/>
</reference>




    </references>


<section anchor="algo" title="Non-Normative Processing Algorithm">

<t>The following algorithm illustrates how a client could handle received ORIGIN frames:</t>

<t><list style="numbers">
  <t>If the client is configured to use a proxy for the connection, ignore the frame and stop processing.</t>
  <t>If the connection is not identified with the “h2” protocol identifier or another protocol that has explicitly opted into this specification, ignore the frame and stop processing.</t>
  <t>If the frame occurs upon any stream except stream 0, ignore the frame and stop processing.</t>
  <t>If any of the flags 0x1, 0x2, 0x4 or 0x8 are set, ignore the frame and stop processing.</t>
  <t>If no previous ORIGIN frame on the connection has reached this step, initialise the Origin Set as per <xref target="set"/>.</t>
  <t>For each Origin field <spanx style="verb">origin_raw</spanx> in the frame payload:
  <list style="numbers">
      <t>Parse <spanx style="verb">origin_raw</spanx> as an ASCII serialization of an origin (<xref target="RFC6454"/>, Section 6.2) and let the result be <spanx style="verb">parsed_origin</spanx>. If parsing fails, skip to the next <spanx style="verb">origin_raw</spanx>.</t>
      <t>Add <spanx style="verb">parsed_origin</spanx> to the Origin Set.</t>
    </list></t>
</list></t>

</section>
<section anchor="server-ops" title="Operational Considerations for Servers">

<t>The ORIGIN frame allows a server to indicate for which origins a given connection ought be used.</t>

<t>For example, it can be used to inform the client that the connection is to only be used for the
SNI-based origin, by sending an empty ORIGIN frame. Or, a larger number of origins can be indicated
by including a payload.</t>

<t>Generally, this information is most useful to send before sending any part of a response that might
initiate a new connection; for example, <spanx style="verb">Link</spanx> headers <xref target="RFC5988"/> in a response HEADERS, or links
in the response body.</t>

<t>Therefore, the ORIGIN frame ought be sent as soon as possible on a connection, ideally before any
HEADERS or PUSH_PROMISE frames.</t>

<t>However, if it’s desirable to associate a large number of origins with a connection, doing so might
introduce end-user perceived latency, due to their size. As a result, it might be necessary to
select a “core” set of origins to send initially, expanding the set of origins the connection is
used for with subsequent ORIGIN frames later (e.g., when the connection is idle).</t>

<t>Senders should note that, as per <xref target="RFC6454"/> Section 4, the values in an ORIGIN header need to be
case-normalised before serialisation.</t>

<t>Finally, servers that allow alternative services <xref target="RFC7838"/> will need to explicitly advertise
those origins when sending ORIGIN, because the default contents of the Origin Set (as per <xref target="set"/>)
do not contain any Alternative Services, even if they have been used previously on the connection.</t>

</section>


  </back>
</rfc>

