<?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.7 -->
<?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 xmlns:x="http://purl.org/net/xml2rfc/ext"
     category="std"
     docName="draft-ietf-httpbis-origin-frame-06"
     ipr="trust200902"
     submissionType="IETF">
   <x:feedback template="mailto:ietf-http-wg@w3.org?subject={docname},%20%22{section}%22\&amp;amp;body=%3c{ref}%3e:"/>
   <front>
      <title abbrev="ORIGIN Frames">The ORIGIN HTTP/2 Frame</title>
      <author fullname="Mark Nottingham" initials="M." surname="Nottingham">
         <address>
            <email>mnot@mnot.net</email>
            <uri>https://www.mnot.net/</uri>
         </address>
      </author>
      <author fullname="Erik Nygren" initials="E." surname="Nygren">
         <organization>Akamai</organization>
         <address>
            <email>nygren@akamai.com</email>
         </address>
      </author>
      <date year="2018" month="January" 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 not usable for a coalesced origin, so the 421 (Misdirected Request) status code (<xref target="RFC7540" x:fmt="," x:sec="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.</t>
         <section anchor="notational-conventions" title="Notational Conventions">
            <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>
         </section>
      </section>
      <section anchor="the-origin-http2-frame" title="The ORIGIN HTTP/2 Frame">
         <t>This document defines a new HTTP/2 frame type (<xref target="RFC7540" x:fmt="," x:sec="4"/>) called ORIGIN, that 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 0xc (decimal 12), and contains zero or more instances of the Origin-Entry field.</t>
            <figure>
               <artwork type="drawing">
+-------------------------------+-------------------------------+
|         Origin-Entry (*)                                    ...
+-------------------------------+-------------------------------+
</artwork>
            </figure>
            <t>An Origin-Entry is a length-delimited string:</t>
            <figure>
               <artwork type="drawing">
+-------------------------------+-------------------------------+
|         Origin-Len (16)       | ASCII-Origin?               ...
+-------------------------------+-------------------------------+
</artwork>
            </figure>
            <t>Specifically:</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" x:fmt="," x:sec="6.2"/>) that the sender asserts 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 to this specification (through IETF consensus) 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, unless the flag’s semantics are understood. 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" x:fmt="," x:sec="6.2"/>). If parsing fails, the field MUST be ignored.</t>
            <t>Note that the ORIGIN frame does not support wildcard names (e.g., “*.example.com”) in Origin-Entry. As a result, sending ORIGIN when a wildcard certificate is in use effectively disables any origins that are not explicitly listed in the ORIGIN frame(s) (when the client understands ORIGIN).</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, the Origin Set for a connection is uninitialised. An uninitialized Origin Set means that clients apply the coalescing rules from <xref target="RFC7540" x:fmt="of" x:sec="9.1.1"/>.</t>
            <t>When an ORIGIN frame is first received and successfully processed by a client, the connection’s Origin Set is defined to contain an initial origin. The initial origin is composed from:</t>
            <t>
               <list style="symbols">
                  <t>Scheme: “https”</t>
                  <t>Host: the value sent in Server Name Indication (SNI, <xref target="RFC6066" x:fmt="," x:sec="3"/>), converted to lower case; if SNI is not present, the remote address of the connection (i.e., the server’s IP address)</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" x:fmt="," x:sec="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" x:fmt="," x:sec="6.2"/>) and remove it from the connection’s Origin Set, if present.</t>
            <t>
               <list style="hanging">
                  <t hangText="Note:">When sending an ORIGIN frame to a connection that is initialised as an Alternative Service <xref target="RFC7838"/>, the initial origin set (<xref target="set"/>) will contain an origin with the appropriate scheme and hostname (since Alternative Services specifies that the origin’s hostname be sent in SNI). However, it is possible that the port will be different than that of the intended origin, since the initial origin set is calculated using the actual port in use, which can be different for the alternative service. In this case, the intended origin needs to be sent in the ORIGIN frame explicitly.</t>
                  <t>For example, a client making requests for “https://example.com” is directed to an alternative service at (“h2”, “x.example.net”, “8443”). If this alternative service sends an ORIGIN frame, the initial origin will be “https://example.com:8443”. The client will not be able to use the alternative service to make requests for “https://example.com” unless that origin is explicitly included in the ORIGIN frame.</t>
               </list>
            </t>
         </section>
         <section anchor="authority" title="Authority, Push and Coalescing with ORIGIN">
            <t>
               <xref target="RFC7540" x:fmt="of" x:sec="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"/>.</t>
            <t>Furthermore, <xref target="RFC7540" x:fmt="of" x:sec="9.1.1"/> explicitly allows a connection to be used for more than one origin server, if it is authoritative. This affects what responses can be considered authoritative, both for direct responses to requests and for server push (see <xref target="RFC7540" x:fmt="," x:sec="8.2.2"/>). Indirectly, it also affects what requests will be sent on a connection, since clients will generally only send requests on connections that they believe to be authoritative for the origin in question.</t>
            <t>Once an Origin Set has been initialised for a connection, clients that implement this specification use it to help determine what the connection is authoritative for. Specifically, such clients MUST NOT consider a connection to be authoritative for an origin not present in the Origin Set, and SHOULD use the connection for all requests to origins in the Origin Set for which the connection is authoritative, unless there are operational reasons for opening a new connection.</t>
            <t>Note that for a connection to be considered authoritative for a given origin, the server is still required to authenticate with certificate that passes suitable checks; see <xref target="RFC7540" x:fmt="of" x:sec="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 rules defined in <xref target="RFC2818"/>; see also <xref target="RFC5280" x:fmt="," x:sec="4.2.1.6"/>).</t>
            <t>Additionally, clients MAY avoid consulting DNS to establish the connection’s authority for new requests to origins in the Origin Set; however, those that do so face new risks, as explained in <xref target="sc"/>.</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 proper subset of another connection’s Origin Set, and SHOULD close it once all outstanding requests are satisfied.</t>
            <t>The Origin Set is unaffected by any alternative services <xref target="RFC7838"/> advertisements made by the server. Advertising an alternative service does not affect whether a server is authoritative.</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: 0xc</t>
               <t>Specification: [this document]</t>
            </list>
         </t>
      </section>
      <section anchor="sc" 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>
         <t>As a result, clients opting not to consult DNS ought to employ some alternative means to establish a high degree of confidence that the certificate is legitimate. For example, clients might skip consulting DNS only if they receive proof of inclusion in a Certificate Transparency log <xref target="RFC6962"/> or they have a recent OCSP response <xref target="RFC6960"/> (possibly using the “status_request” TLS extension <xref target="RFC6066"/>) showing that the certificate was not revoked.</t>
         <t>The Origin Set’s size is unbounded by this specification, and thus could be used by attackers to exhaust client resources. To mitigate this risk, clients can monitor their state commitment and close the connection if it is too high.</t>
      </section>
   </middle>
   <back>
      <references title="Normative References">
         <reference anchor="RFC7540">
            <front>
               <title>Hypertext Transfer Protocol Version 2 (HTTP/2)</title>
               <author fullname="M. Belshe" initials="M." surname="Belshe"/>
               <author fullname="R. Peon" initials="R." surname="Peon"/>
               <author fullname="M. Thomson"
                       initials="M."
                       role="editor"
                       surname="Thomson"/>
               <date month="May" year="2015"/>
            </front>
            <seriesInfo name="RFC" value="7540"/>
            <seriesInfo name="DOI" value="10.17487/RFC7540"/>
         </reference>
         <reference anchor="RFC6454">
            <front>
               <title>The Web Origin Concept</title>
               <author fullname="A. Barth" initials="A." surname="Barth"/>
               <date month="December" year="2011"/>
            </front>
            <seriesInfo name="RFC" value="6454"/>
            <seriesInfo name="DOI" value="10.17487/RFC6454"/>
         </reference>
         <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="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="RFC6066">
            <front>
               <title>Transport Layer Security (TLS) Extensions: Extension Definitions</title>
               <author fullname="D. Eastlake 3rd" initials="D." surname="Eastlake 3rd"/>
               <date month="January" year="2011"/>
            </front>
            <seriesInfo name="RFC" value="6066"/>
            <seriesInfo name="DOI" value="10.17487/RFC6066"/>
         </reference>
         <reference anchor="RFC2818">
            <front>
               <title>HTTP Over TLS</title>
               <author fullname="E. Rescorla" initials="E." surname="Rescorla"/>
               <date month="May" year="2000"/>
            </front>
            <seriesInfo name="RFC" value="2818"/>
            <seriesInfo name="DOI" value="10.17487/RFC2818"/>
         </reference>
         <reference anchor="RFC5280">
            <front>
               <title>Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile</title>
               <author fullname="D. Cooper" initials="D." surname="Cooper"/>
               <author fullname="S. Santesson" initials="S." surname="Santesson"/>
               <author fullname="S. Farrell" initials="S." surname="Farrell"/>
               <author fullname="S. Boeyen" initials="S." surname="Boeyen"/>
               <author fullname="R. Housley" initials="R." surname="Housley"/>
               <author fullname="W. Polk" initials="W." surname="Polk"/>
               <date month="May" year="2008"/>
            </front>
            <seriesInfo name="RFC" value="5280"/>
            <seriesInfo name="DOI" value="10.17487/RFC5280"/>
         </reference>
      </references>
      <references title="Informative References">
         <reference anchor="RFC7838">
            <front>
               <title>HTTP Alternative Services</title>
               <author fullname="M. Nottingham" initials="M." surname="Nottingham"/>
               <author fullname="P. McManus" initials="P." surname="McManus"/>
               <author fullname="J. Reschke" initials="J." surname="Reschke"/>
               <date month="April" year="2016"/>
            </front>
            <seriesInfo name="RFC" value="7838"/>
            <seriesInfo name="DOI" value="10.17487/RFC7838"/>
         </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="RFC6962">
            <front>
               <title>Certificate Transparency</title>
               <author fullname="B. Laurie" initials="B." surname="Laurie"/>
               <author fullname="A. Langley" initials="A." surname="Langley"/>
               <author fullname="E. Kasper" initials="E." surname="Kasper"/>
               <date month="June" year="2013"/>
            </front>
            <seriesInfo name="RFC" value="6962"/>
            <seriesInfo name="DOI" value="10.17487/RFC6962"/>
         </reference>
         <reference anchor="RFC6960">
            <front>
               <title>X.509 Internet Public Key Infrastructure Online Certificate Status Protocol - OCSP</title>
               <author fullname="S. Santesson" initials="S." surname="Santesson"/>
               <author fullname="M. Myers" initials="M." surname="Myers"/>
               <author fullname="R. Ankney" initials="R." surname="Ankney"/>
               <author fullname="A. Malpani" initials="A." surname="Malpani"/>
               <author fullname="S. Galperin" initials="S." surname="Galperin"/>
               <author fullname="C. Adams" initials="C." surname="Adams"/>
               <date month="June" year="2013"/>
            </front>
            <seriesInfo name="RFC" value="6960"/>
            <seriesInfo name="DOI" value="10.17487/RFC6960"/>
         </reference>
         <reference anchor="RFC8288">
            <front>
               <title>Web Linking</title>
               <author fullname="M. Nottingham" initials="M." surname="Nottingham"/>
               <date month="October" year="2017"/>
            </front>
            <seriesInfo name="RFC" value="8288"/>
            <seriesInfo name="DOI" value="10.17487/RFC8288"/>
         </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 <spanx style="verb">Origin-Entry</spanx> in the frame payload: <list style="numbers">
                     <t>Parse <spanx style="verb">ASCII-Origin</spanx> as an ASCII serialization of an origin (<xref target="RFC6454" x:fmt="," x:sec="6.2"/>) and let the result be <spanx style="verb">parsed_origin</spanx>. If parsing fails, skip to the next <spanx style="verb">Origin-Entry</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. The set of origins advertised using this mechanism is under control of the server; servers are not obligated to use it, or to advertise all origins which they might be able to answer a request for.</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> header fields <xref target="RFC8288"/> 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>That said, senders are encouraged to include as many origins as practical within a single ORIGIN frame; clients need to make decisions about creating connections on the fly, and if the origin set is split across many frames, their behaviour might be suboptimal.</t>
         <t>Senders take note that, as per Section 4, Step 5 of <xref target="RFC6454"/>, the values in an ORIGIN header need to be case-normalised before serialisation.</t>
         <t>Finally, servers that host alternative services <xref target="RFC7838"/> will need to explicitly advertise their origins when sending ORIGIN, because the default contents of the Origin Set (as per <xref target="set"/>) do not contain any Alternative Services’ origins, even if they have been used previously on the connection.</t>
      </section>
   </back>
</rfc>
