RFC 8336
The ORIGIN HTTP/2 Frame
RFC 8336: The ORIGIN HTTP/2 Frame ๐ฆ
Okay bestie, the header info first because it's important ๐
Internet Engineering Task Force (IETF) Authors: M. Nottingham and E. Nygren, both from Akamai Technologies ๐ธ Category: Standards Track ISSN: 2070-1721 Date: March 2018 Obsoletes/Updates: nothing listed in the header ๐คทโโ๏ธ
Abstract
So this doc spells out the ORIGIN frame for HTTP/2 ๐ Its whole job is to tell you which origins are available on a given connection. Main character energy โจ
Status of This Memo
This is an Internet Standards Track document ๐
It's a product of the Internet Engineering Task Force (IETF), so it reflects what the whole IETF community agrees on. It went through public review and got approved for publication by the Internet Engineering Steering Group (IESG). If you want more on Internet Standards, check out Section 2 of RFC 7841 ๐
You can find the current status, any errata, and how to send feedback at https://www.rfc-editor.org/info/rfc8336 ๐
Copyright Notice
Copyright (c) 2018 IETF Trust and the persons identified as the document authors. All rights reserved. ๐ฆ
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) as they were in effect on the date of publication. Please actually read these, because they spell out your rights and restrictions for this document ๐
If you pull Code Components out of this document, they have to include the Simplified BSD License text, as described in Section 4.e of the Trust Legal Provisions. They come without warranty, as described in the Simplified BSD License itself ๐
Table of Contents
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1. Notational Conventions . . . . . . . . . . . . . . . . . 2
2. The ORIGIN HTTP/2 Frame . . . . . . . . . . . . . . . . . . . 3
2.1. Syntax . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2. Processing ORIGIN Frames . . . . . . . . . . . . . . . . 3
2.3. The Origin Set . . . . . . . . . . . . . . . . . . . . . 4
2.4. Authority, Push, and Coalescing with ORIGIN . . . . . . . 6
3. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 7
4. Security Considerations . . . . . . . . . . . . . . . . . . . 7
5. References . . . . . . . . . . . . . . . . . . . . . . . . . 8
5.1. Normative References . . . . . . . . . . . . . . . . . . 8
5.2. Informative References . . . . . . . . . . . . . . . . . 8
Appendix A. Non-Normative Processing Algorithm . . . . . . . . . 10
Appendix B. Operational Considerations for Servers . . . . . . . 10
Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 11
1. Introduction โจ
So HTTP/2 [RFC7540] lets clients coalesce different origins [RFC6454] onto one connection, as long as certain conditions are met ๐ซถ But sometimes a connection can't actually be used for a coalesced origin, and that's when the 421 (Misdirected Request) status code ([RFC7540], Section 9.1.2) comes in ๐
Using that status code does let clients recover from misdirected requests, but it costs latency, and nobody wants that ๐ญ To fix it, this spec defines a brand new HTTP/2 frame type, "ORIGIN", so servers can say which origins a connection is actually usable for ๐
Also, experience has shown that HTTP/2's requirement to establish server authority using both DNS and the server's certificate is kinda onerous ๐ So this spec relaxes that: when the ORIGIN frame is in use, clients don't have to check DNS. That comes with extra perks too, like skipping the latency of some DNS lookups ๐ง
1.1. Notational Conventions ๐ธ
Here's the deal with the key words. The BCP 14 key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" are only to be read as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they show up in all capitals, exactly like this ๐ Any other vibe, not a requirement ๐ โโ๏ธ
2. The ORIGIN HTTP/2 Frame ๐
This doc defines a new HTTP/2 frame type ([RFC7540], Section 4) called ORIGIN. It lets a server tell the client which origin(s) [RFC6454] it'd like the client to treat as members of the Origin Set (Section 2.3) for the connection the frame shows up on ๐
2.1. Syntax ๐ฆ
The ORIGIN frame type is 0xc (decimal 12), and it holds zero or more instances of the Origin-Entry field ๐งฉ
+-------------------------------+-------------------------------+
| Origin-Entry (*) ...
+-------------------------------+-------------------------------+
An Origin-Entry is a length-delimited string ๐
+-------------------------------+-------------------------------+
| Origin-Len (16) | ASCII-Origin? ...
+-------------------------------+-------------------------------+
Here's what's in there, specifically:
Origin-Len: An unsigned, 16-bit integer. It tells you how long, in octets, theASCII-Originfield is ๐Origin: An OPTIONAL sequence of characters holding the ASCII serialization of an origin ([RFC6454], Section 6.2). It's the origin the sender is saying this connection is, or could be, authoritative for ๐
The ORIGIN frame doesn't define any flags. But future updates to this spec MAY define flags, so keep an eye out ๐ See Section 2.2 for more ๐
2.2. Processing ORIGIN Frames ๐
The ORIGIN frame is a non-critical extension to HTTP/2, so endpoints that don't support it can safely ignore it when they get it โจ
When an implementing client receives one, it uses the frame to initialize and manipulate the Origin Set (see Section 2.3). That changes how the client establishes authority for origin servers (see Section 2.4) ๐ฅ
The ORIGIN frame MUST be sent on stream 0. An ORIGIN frame on any other stream is invalid and MUST be ignored. Stream 0 or bust, bestie ๐ซ
Also, the ORIGIN frame is only valid on connections with the "h2" protocol identifier, or when the protocol's definition specifically nominates it. If it shows up on a connection with the "h2c" protocol identifier, it MUST be ignored ๐
This spec doesn't define any flags for the ORIGIN frame. Future updates (through IETF consensus) might use them to change its semantics, though ๐ The first four flags (0x1, 0x2, 0x4, and 0x8) are reserved for backwards-incompatible changes. So when any of them are set, clients conforming to this spec MUST ignore the ORIGIN frame containing them, unless they understand the flag's semantics. The remaining flags are reserved for backwards-compatible changes, and they don't affect processing by clients that conform to this spec ๐ง
The ORIGIN frame describes a property of the connection, so it's processed hop by hop. An intermediary MUST NOT forward ORIGIN frames. And clients configured to use a proxy MUST ignore any ORIGIN frames they get from it ๐
Each ASCII-Origin field in the frame's payload MUST be parsed as an ASCII serialization of an origin ([RFC6454], Section 6.2). If parsing fails, the field MUST be ignored ๐ฅฒ
Heads up: the ORIGIN frame doesn't support wildcard names (for example, "*.example.com") in Origin-Entry. So if you send ORIGIN while a wildcard certificate is in use, you effectively disable every origin that isn't explicitly listed in the ORIGIN frame(s), at least for clients that understand ORIGIN ๐
Hold up, this one's a big deal. Wildcards + ORIGIN = any origin you didn't list explicitly gets switched off for clients that understand the frame. Plan accordingly ๐จ
See Appendix A for an illustrative algorithm for processing ORIGIN frames ๐
2.3. The Origin Set ๐
The set of origins (as per [RFC6454]) that a given connection might be used for is what this spec calls the Origin Set ๐ซง
By default, the Origin Set for a connection is uninitialized. An uninitialized Origin Set means that clients apply the coalescing rules from Section 9.1.1 of [RFC7540] ๐ธ
When an ORIGIN frame is first received and successfully processed by a client, the connection's Origin Set gets defined to contain an initial origin. The initial origin is built from three pieces ๐งฉ
- Scheme:
"https" - Host: the value sent in Server Name Indication (SNI) ([RFC6066], Section 3), converted to lower case. If SNI isn't present, it's the remote address of the connection (i.e., the server's IP address) ๐
- Port: the remote port of the connection (i.e., the server's port) ๐
The contents of that ORIGIN frame (and any subsequent ones) let the server incrementally add new origins to the Origin Set, as described in Section 2.2 ๐ฆ
The 421 (Misdirected Request) response status code, as defined in [RFC7540], Section 9.1.2, also affects the Origin Set ๐ญ When a response with this status code comes in, implementing clients MUST create the ASCII serialization of the corresponding request's origin (as per [RFC6454], Section 6.2) and remove it from the connection's Origin Set, if it's there ๐ โโ๏ธ
Note: When you send an ORIGIN frame to a connection that was initialized as an alternative service [RFC7838], the initial Origin Set (Section 2.3) will contain an origin with the right scheme and hostname. That's because RFC 7838 says the origin's hostname has to be sent in SNI. But the port might be different from the intended origin's port, since the initial Origin Set is calculated from the actual port in use, and that can differ for the alternative service. In that case, the intended origin needs to be sent explicitly in the ORIGIN frame ๐
Here's an example so it clicks. A client making requests for https://example.com gets directed to an alternative service at (h2, x.example.net, 8443). If that alternative service sends an ORIGIN frame, the initial origin will be https://example.com:8443. The client won't be able to use the alternative service for requests to https://example.com unless that origin is explicitly included in the ORIGIN frame ๐ง Port drama, iykyk ๐
2.4. Authority, Push, and Coalescing with ORIGIN โจ
okay so bestie, this part is where the magic really happens ๐ฎ Section 10.1 of [RFC7540] uses BOTH DNS and the presented Transport Layer Security (TLS) certificate to figure out which origin servers a connection is authoritative for, just like HTTP/1.1 does in [RFC7230]. ๐ฆ
Also, Section 9.1.1 of [RFC7540] straight up lets one connection be used for more than one origin server, as long as it's authoritative ๐ This changes which responses count as authoritative, both for direct responses and for server push (see [RFC7540], Section 8.2.2). And indirectly it changes which requests get sent on a connection, since clients generally only send requests on connections they believe are authoritative for the origin in question. It's giving connection-sharing realness ๐
Once an Origin Set has been initialized for a connection, clients that implement this specification use it to help decide what the connection is authoritative for. Specifically, such clients MUST NOT consider a connection to be authoritative for an origin that isn't in the Origin Set, and they SHOULD use the connection for all requests to origins in the Origin Set that the connection is authoritative for, unless there are operational reasons to open a new connection. Main character rules, no cap ๐
Quick reminder: even with ORIGIN, the server still has to authenticate with a certificate that passes proper checks ๐ See Section 9.1.1 of [RFC7540] for the full scoop. This includes checking that the host matches a "dNSName" value from the certificate "subjectAltName" field (using the rules defined in [RFC2818]; see also [RFC5280], Section 4.2.1.6). No skipping the vibe check! ๐ซถ
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 Section 4. Bold choice, but it comes with consequences ๐
Because ORIGIN can change the set of origins a connection is used for over time, a client might have more than one viable connection to the same origin open at any time ๐ When this happens, clients SHOULD NOT send new requests on any connection whose Origin Set is a proper subset of another connection's Origin Set, and they SHOULD close it once all outstanding requests are satisfied. Tidy up those extra tabs, babe ๐งน
The Origin Set is unaffected by any alternative services [RFC7838] advertisements made by the server. Advertising an alternative service does not affect whether a server is authoritative. Two separate vibes, not the same thing at all ๐
3. IANA Considerations ๐
This specification adds an entry to the "HTTP/2 Frame Type" registry ๐ง
- Frame Type:
ORIGIN - Code:
0xc - Specification:
RFC 8336
4. Security Considerations ๐จ
Okay, serious moment, bestie ๐ญ Clients that blindly trust the ORIGIN frame's contents will be vulnerable to a large number of attacks. See Section 2.4 for mitigations. Please don't be that client ๐
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 messing with DNS, they only need to convince the user to visit another website in order to coalesce connections to the target onto their existing connection. Scary, right? ๐
As a result, clients that opt 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 [RFC6962] or if they have a recent Online Certificate Status Protocol (OCSP) response [RFC6960] (possibly using the "status_request" TLS extension [RFC6066]) showing that the certificate was not revoked ๐โจ
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. Don't let the set get out of hand, queen ๐๐ฅ
5. References ๐
5.1. Normative References
- [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, <https://www.rfc-editor.org/info/rfc2119>.
- [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, DOI 10.17487/RFC2818, May 2000, <https://www.rfc-editor.org/info/rfc2818>.
- [RFC5280] Cooper, D., Santesson, S., Farrell, S., Boeyen, S., Housley, R., and W. Polk, "Internet X.509 Public Key Infrastructure Certificate and Certificate Revocation List (CRL) Profile", RFC 5280, DOI 10.17487/RFC5280, May 2008, <https://www.rfc-editor.org/info/rfc5280>.
- [RFC6066] Eastlake 3rd, D., "Transport Layer Security (TLS) Extensions: Extension Definitions", RFC 6066, DOI 10.17487/RFC6066, January 2011, <https://www.rfc-editor.org/info/rfc6066>.
- [RFC6454] Barth, A., "The Web Origin Concept", RFC 6454, DOI 10.17487/RFC6454, December 2011, <https://www.rfc-editor.org/info/rfc6454>.
- [RFC7540] Belshe, M., Peon, R., and M. Thomson, Ed., "Hypertext Transfer Protocol Version 2 (HTTP/2)", RFC 7540, DOI 10.17487/RFC7540, May 2015, <https://www.rfc-editor.org/info/rfc7540>.
- [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174, May 2017, <https://www.rfc-editor.org/info/rfc8174>.
5.2. Informative References
- [RFC6960] Santesson, S., Myers, M., Ankney, R., Malpani, A., Galperin, S., and C. Adams, "X.509 Internet Public Key Infrastructure Online Certificate Status Protocol - OCSP", RFC 6960, DOI 10.17487/RFC6960, June 2013, <https://www.rfc-editor.org/info/rfc6960>.
- [RFC6962] Laurie, B., Langley, A., and E. Kasper, "Certificate Transparency", RFC 6962, DOI 10.17487/RFC6962, June 2013, <https://www.rfc-editor.org/info/rfc6962>.
- [RFC7230] Fielding, R., Ed. and J. Reschke, Ed., "Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing", RFC 7230, DOI 10.17487/RFC7230, June 2014, <https://www.rfc-editor.org/info/rfc7230>.
- [RFC7838] Nottingham, M., McManus, P., and J. Reschke, "HTTP Alternative Services", RFC 7838, DOI 10.17487/RFC7838, April 2016, <https://www.rfc-editor.org/info/rfc7838>.
- [RFC8288] Nottingham, M., "Web Linking", RFC 8288, DOI 10.17487/RFC8288, October 2017, <https://www.rfc-editor.org/info/rfc8288>.
Appendix A. Non-Normative Processing Algorithm ๐ง
The following algorithm illustrates how a client could handle received ORIGIN frames ๐
- If the client is configured to use a proxy for the connection, ignore the frame and stop processing.
- 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.
- If the frame occurs upon any stream except stream 0, ignore the frame and stop processing.
- If any of the flags 0x1, 0x2, 0x4, or 0x8 are set, ignore the frame and stop processing.
- If no previous ORIGIN frame on the connection has reached this step, initialize the Origin Set as per Section 2.3.
- For each "Origin-Entry" in the frame payload:
- Parse "ASCII-Origin" as an ASCII serialization of an origin ([RFC6454], Section 6.2), and let the result be "parsed_origin". If parsing fails, skip to the next "Origin-Entry".
- Add "parsed_origin" to the Origin Set.
Appendix B. Operational Considerations for Servers ๐
The ORIGIN frame allows a server to indicate which origins a given connection ought to be used for. 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 that they might be able to answer a request for. Your server, your rules ๐
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 ๐ธ
Generally, this information is most useful to send before sending any part of a response that might initiate a new connection, for example "Link" response header fields [RFC8288], or links in the response body. Get the info out early, bestie โญ
Therefore, the ORIGIN frame ought to be sent as soon as possible on a connection, ideally before any HEADERS or PUSH_PROMISE frames. Timing is everything ๐ง
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, and expand the set of origins the connection is used for with subsequent ORIGIN frames later (e.g., when the connection is idle). Start small, grow later ๐ฆ
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 behavior might be suboptimal. One big frame > many tiny ones ๐ซถ
Senders take note that, as per Section 4, Step 5, of [RFC6454], the values in an ORIGIN header need to be case-normalized before serialization. Lowercase energy only ๐ค
Finally, servers that host alternative services [RFC7838] will need to explicitly advertise their origins when sending ORIGIN, because the default contents of the Origin Set (as per Section 2.3) do not contain any alternative services' origins, even if they have been used previously on the connection. Don't forget your alt-svc crew ๐
Authors' Addresses ๐
Mark Nottingham
Email: mnot@mnot.net URI: https://www.mnot.net/
Erik Nygren Akamai Technologies
Email: erik+ietf@nygren.org
๐ฆ where this page comes from
- ietf: rfc8336 2018-03
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms