Internet-Draft | HTTP Availability Hints | March 2023 |
Nottingham | Expires 12 September 2023 | [Page] |
This specification defines availability hints, a new class of HTTP responses headers that augment the information in the Vary header field.¶
This note is to be removed before publishing as an RFC.¶
Status information for this document may be found at https://datatracker.ietf.org/doc/draft-nottingham-http-availability-hints/.¶
information can be found at https://mnot.github.io/I-D/.¶
Source for this draft and an issue tracker can be found at https://github.com/mnot/I-D/labels/availability-hints.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on 12 September 2023.¶
Copyright (c) 2023 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) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.¶
The HTTP Vary header field (Section 12.5.5 of [HTTP]) allows an origin server to describe what aspects of requests affect the content of its responses. This information is useful in many ways; most prominently, downstream caches can use it to select the correct stored response for a given request (Section 4.1 of [HTTP-CACHING]).¶
However, the information conveyed by Vary is limited. If the request headers enumerated in it are considered as a n-dimensional space with each field representing an axis, this response header:¶
indicates that there is a three-dimensional space of potential responses that could be sent. However, nothing more is conveyed; the number and nature of the entries on each axis are not available, leaving caches and other downstream consumers none the wiser as to how broad this space is, or how to navigate it.¶
This design makes using Vary difficult. A cache doesn't have enough information available to decide whether one of its stored responses is the best to satisfy a given request in all but the most simple circumstances.¶
For example, if a request indicates that the client prefers responses in the French language, but will also accept English, and the cache has a stored English response, what is the appropriate action? Should it serve the English response, or should it make a request to the server for a French response and hope that one might be available -- adding significant latency if it is not?¶
This specification defines a new type of HTTP header field -- an availability hint -- that augments the information on a single axis of content negotiation, by describing the selection of responses that a server has available along that axis. So, our example above have three availabilty hints added to it:¶
This says that there are two encodings available -- gzip and brotli -- beyond the mandatory "identity" encoding; that both French and English are available, but English is the default; and that there are two different representations available depending on the Effective Connection Type that the client advertises, with "4g" being the default.¶
Caches and other clients can use this information to determine when a request can be satisfied by a stored response, and what other options might be available. Using the example above, we can know that the response to a request an ECT of "2g" can also be used for a request with "3g".¶
Availability hints have some limitations. While a server's preferences along a single axis of negotiation can be conveyed by the corresponding availability hint, its relative preferences between multiple axes are not. In the example above, it isn't possible to know whether the server prefers that downstream caches and clients use the brotli-encoded French version over the gzip-encoded English version.¶
Likewise, it is't possible to convey "holes" in the dimensional space described by Vary. For example, a gzip-encoded French response may not be available from the server. This specification does not attempt to address this shortcoming.¶
Availability hints do not specify exactly how caches should behave in all circumstances. Because they operate as an optimisation, they often have different behaviours based upon the specific requirements of their deployment. Availability hints are designed to better inform their operation, not constrain it.¶
Finally, availability hints need to be defined for each axis of content negotiation in use, and the recipient (such as a cache) needs to understand that availability hint. If either condition is not true, that axis of negotiation will fall back to the behaviour specified by Vary.¶
Section 2 describes how availability hints are defined. Section 4 specifies how availability hints are processed, with respect to the Vary header field. Section 5 defines a number of availability hints for existing HTTP content negotiation mechanisms.¶
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 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.¶
The specification for an availability hint applies to a single axis of HTTP proactive content negotiation; for example, that enabled by the Accept-Encoding
request header field.¶
An availability hint specification needs to convey the following information:¶
The response header field should be defined as a Structured Field [STRUCTURED-FIELDS].¶
It is recommended that the selection algorithm operate solely using information in the stored responses and presented request, if possible. If the selection algorithm can return multiple available responses, they should indicate an order of preference.¶
Either the response header field or the algorithm should indicate which of the available responses is the default -- i.e., which is used if none match.¶
TBD - advice to sites about how to publish / use availability hints¶
When presented with a response that has both a Vary header field and one or more availability hints, this specification augments the process defined in Section 4.1 of [HTTP-CACHING].¶
While the model there is defined in terms of whether the header fields from two requests match, availability hints invoke a different processing model; the set of stored responses that can be used to satisfy a presented request is found by:¶
For each content negotiation axis in the Vary header field, determine which stored responses can be selected by running the corresponding selection algorithm, as defined by the availability hint.¶
This specification does not define how to select the most appropriate response when more than one is returned, but it is RECOMMENDED that client preferences be observed when expressed.¶
The following subsections define availability hints for a selection of existing content negotiation mechanisms.¶
The Avail-Encoding response header field is the availability hint for content negotiation using the Accept-Encoding request header field defined in Section 12.5.3 of [HTTP]. For example:¶
Avail-Encoding is a Structured Field, whose value is a List (Section 3.1 of [STRUCTURED-FIELDS]) of Tokens (Section 3.3.4 of [STRUCTURED-FIELDS]). Each list item indicates a content-coding that is available for the resource. Additionally, the "identity" encoding is always considered to be available, and is the default encoding.¶
The selection algorithm for this axis of content negotiation is described in Section 12.5.3 of [HTTP].¶
The Avail-Format response header field is the availability hint for content negotiation using the Accept request header field defined in Section 12.5.1 of [HTTP]. For example:¶
Avail-Format is a Structured Field, whose value is a List (Section 3.1 of [STRUCTURED-FIELDS]) of Tokens (Section 3.3.4 of [STRUCTURED-FIELDS]). Each list item indicates a media type ("type/subtype") that is available for the resource.¶
A single member of the List MAY have the "d" parameter, which indicates that member is the default format.¶
The selection algorithm for this axis of content negotiation is described in Section 12.5.1 of [HTTP].¶
The Avail-Language response header field is the availability hint for content negotiation using the Accept-Language request header field defined in Section 12.5.4 of [HTTP]. For example:¶
Avail-Format is a Structured Field, whose value is a List (Section 3.1 of [STRUCTURED-FIELDS]) of Tokens (Section 3.3.4 of [STRUCTURED-FIELDS]). Each list item indicates a language tag that is available for the resource.¶
A single member of the List MAY have the "d" parameter, which indicates that member is the default language.¶
The selection algorithm for this axis of content negotiation is described in Section 12.5.4 of [HTTP].¶
TBD¶
Avail-DPR:¶