<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<!-- generated by https://github.com/cabo/kramdown-rfc version 1.7.24 (Ruby 3.3.6) -->
<?rfc tocindent="yes"?>
<?rfc strict="yes"?>
<?rfc compact="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-ietf-httpbis-cache-groups-04" category="std" consensus="true" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.28.0 -->
  <front>
    <title>HTTP Cache Groups</title>
    <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-cache-groups-04"/>
    <author initials="M." surname="Nottingham" fullname="Mark Nottingham">
      <organization/>
      <address>
        <postal>
          <postalLine>Prahran</postalLine>
          <postalLine>Australia</postalLine>
        </postal>
        <email>mnot@mnot.net</email>
        <uri>https://www.mnot.net/</uri>
      </address>
    </author>
    <date/>
    <area>Web and Internet Transport</area>
    <workgroup>HTTP</workgroup>
    <keyword>HTTP, Caching, Invalidation</keyword>
    <abstract>
      <?line 48?>

<t>This specification introduces a means of describing the relationships between stored responses in HTTP caches, "grouping" them by associating a stored response with one or more opaque strings.</t>
    </abstract>
    <note removeInRFC="true">
      <name>About This Document</name>
      <t>
        Status information for this document may be found at <eref target="https://datatracker.ietf.org/doc/draft-ietf-httpbis-cache-groups/"/>.
      </t>
      <t>
        Discussion of this document takes place on the
        HTTP Working Group mailing list (<eref target="mailto:ietf-http-wg@w3.org"/>),
        which is archived at <eref target="https://lists.w3.org/Archives/Public/ietf-http-wg/"/>.
        Working Group information can be found at <eref target="https://httpwg.org/"/>.
      </t>
      <t>Source for this draft and an issue tracker can be found at
        <eref target="https://github.com/httpwg/http-extensions/labels/cache-groups"/>.</t>
    </note>
  </front>
  <middle>
    <?line 52?>

<section anchor="introduction">
      <name>Introduction</name>
      <t>HTTP caching <xref target="HTTP-CACHING"/> operates at the granularity of a single resource; the freshness of one stored response does not affect that of others. This granularity can make caching more efficient -- for example, when a page is composed of many assets that have different requirements for caching.</t>
      <t>However, there are also cases where the relationship between stored responses could be used to improve cache efficiency.</t>
      <t>For example, it is often necessary to invalidate a set of related resources. This might be because a state-changing request has side effects on other resources, or it might be purely for administrative convenience (e.g., "invalidate this part of the site"). Grouping responses together provides a dedicated way to express these relationships, instead of relying on things like URL structure.</t>
      <t>In addition to sharing invalidation events, the relationships indicated by grouping can also be used by caches to optimise their operation; for example, it could be used to inform the operation of cache eviction algorithms.</t>
      <t><xref target="cache-groups"/> introduces a means of describing the relationships between stored responses in HTTP caches, by associating those responses with one or more groups that reflect those relationships and that are identified by opaque strings. It also describes how caches can use that information to apply invalidation events to members of a group.</t>
      <t><xref target="cache-group-invalidation"/> introduces one new source of such events: a HTTP response header field that allows a state-changing response to trigger a group invalidation.</t>
      <t>These mechanisms operate within a single cache, across the stored responses associated with a single origin server. They do not address the issues of synchronising state between multiple caches (e.g., in a hierarchy or mesh), nor do they facilitate association of stored responses from disparate origins.</t>
      <section anchor="notational-conventions">
        <name>Notational Conventions</name>
        <t>The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
"<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" 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>
        <?line -18?>

<t>This specification uses the following terminology from <xref target="STRUCTURED-FIELDS"/>: List, String, Parameter.</t>
      </section>
    </section>
    <section anchor="cache-groups">
      <name>The Cache-Groups Response Header Field</name>
      <t>The Cache-Groups HTTP Response Header is a List of Strings <xref target="STRUCTURED-FIELDS"/>. Each member of the list is an opaque value that identifies a group that the response belongs to.</t>
      <sourcecode type="http-message"><![CDATA[
HTTP/1.1 200 OK
Content-Type: application/javascript
Cache-Control: max-age=3600
Cache-Groups: "scripts"
]]></sourcecode>
      <t>The ordering of members is not significant. Unrecognised Parameters <bcp14>MUST</bcp14> be ignored.</t>
      <t>Implementations <bcp14>MUST</bcp14> support at least 128 groups in a field value, with up to at least 128 characters in each member. Note that generic limitations on HTTP field lengths may constrain the size of this field value in practice.</t>
      <section anchor="identify">
        <name>Identifying Grouped Responses</name>
        <t>Two responses stored in the same cache are considered to belong to the same group when all of the following conditions are met:</t>
        <ol spacing="normal" type="1"><li>
            <t>They both contain a Cache-Groups response header field that contains the same String (in any position in the List), when compared character-by-character.</t>
          </li>
          <li>
            <t>They both share the same URI origin (per <xref section="4.3.1" sectionFormat="of" target="HTTP"/>).</t>
          </li>
        </ol>
      </section>
      <section anchor="cache-behaviour">
        <name>Cache Behaviour</name>
        <section anchor="invalidation">
          <name>Invalidation</name>
          <t>A cache that invalidates a stored response <bcp14>MAY</bcp14> invalidate any stored responses that share groups (per <xref target="identify"/>) with that response.</t>
          <t>Cache extensions can explicitly strengthen the requirement above. For example, a targeted cache control header field <xref target="TARGETED"/> might specify that caches processing it are required to invalidate such responses.</t>
        </section>
      </section>
    </section>
    <section anchor="cache-group-invalidation">
      <name>The Cache-Group-Invalidation Response Header Field</name>
      <t>The Cache-Group-Invalidation response header field is a List of Strings <xref target="STRUCTURED-FIELDS"/>. Each member of the list is an opaque value that identifies a group that the response invalidates, per <xref target="invalidation"/>.</t>
      <t>For example, following a POST request that has side effects on two cache groups, the corresponding response could indicate that stored responses associated with either or both of those groups should be invalidated with:</t>
      <sourcecode type="http-message"><![CDATA[
HTTP/1.1 200 OK
Content-Type: text/html
Cache-Group-Invalidation: "eurovision-results", "kylie-minogue"
]]></sourcecode>
      <t>The Cache-Group-Invalidation header field <bcp14>MUST</bcp14> be ignored on responses to requests that have a safe method (e.g., GET; see <xref section="9.2.1" sectionFormat="of" target="HTTP"/>).</t>
      <t>A cache that receives a Cache-Group-Invalidation header field on a response to an unsafe request <bcp14>MAY</bcp14> invalidate any stored responses that share groups (per <xref target="identify"/>) with any of the listed groups.</t>
      <t>Cache extensions can explicitly strengthen the requirement above. For example, a targeted cache control header field <xref target="TARGETED"/> might specify that caches processing it are required to respect the Cache-Group-Invalidation signal.</t>
      <t>The ordering of members is not significant. Unrecognised Parameters <bcp14>MUST</bcp14> be ignored.</t>
      <t>Implementations <bcp14>MUST</bcp14> support at least 128 groups in a field value, with up to at least 128 characters in each member. Note that generic limitations on HTTP field lengths may constrain the size of this field value in practice.</t>
    </section>
    <section anchor="iana-considerations">
      <name>IANA Considerations</name>
      <t>IANA should perform the following tasks:</t>
      <section anchor="http-field-names">
        <name>HTTP Field Names</name>
        <t>Enter the following into the Hypertext Transfer Protocol (HTTP) Field Name Registry:</t>
        <ul spacing="normal">
          <li>
            <t>Field Name: Cache-Groups</t>
          </li>
          <li>
            <t>Status: permanent</t>
          </li>
          <li>
            <t>Reference: RFC nnnn</t>
          </li>
          <li>
            <t>Comments:</t>
          </li>
          <li>
            <t>Field Name: Cache-Group-Invalidation</t>
          </li>
          <li>
            <t>Status: permanent</t>
          </li>
          <li>
            <t>Reference: RFC nnnn</t>
          </li>
          <li>
            <t>Comments:</t>
          </li>
        </ul>
      </section>
    </section>
    <section anchor="security-considerations">
      <name>Security Considerations</name>
      <t>This mechanism allows resources that share an origin to invalidate each other. Because of this,
origins that represent multiple parties (sometimes referred to as "shared hosting") might allow
one party to group its resources with those of others, or to send signals which have side effects upon them.</t>
      <t>Shared hosts that wish to mitigate these risks can control access to the header fields defined in this specification.</t>
    </section>
  </middle>
  <back>
    <references anchor="sec-combined-references">
      <name>References</name>
      <references anchor="sec-normative-references">
        <name>Normative References</name>
        <reference anchor="HTTP">
          <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="HTTP-CACHING">
          <front>
            <title>HTTP Caching</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 defines HTTP caches and the associated header fields that control cache behavior or indicate cacheable response messages.</t>
              <t>This document obsoletes RFC 7234.</t>
            </abstract>
          </front>
          <seriesInfo name="STD" value="98"/>
          <seriesInfo name="RFC" value="9111"/>
          <seriesInfo name="DOI" value="10.17487/RFC9111"/>
        </reference>
        <reference anchor="STRUCTURED-FIELDS">
          <front>
            <title>Structured Field Values for HTTP</title>
            <author fullname="M. Nottingham" initials="M." surname="Nottingham"/>
            <author fullname="P-H. Kamp" surname="P-H. Kamp"/>
            <date month="September" year="2024"/>
            <abstract>
              <t>This document describes a set of data types and associated algorithms that are intended to make it easier and safer to define and handle HTTP header and trailer fields, known as "Structured Fields", "Structured Headers", or "Structured Trailers". It is intended for use by specifications of new HTTP fields.</t>
              <t>This document obsoletes RFC 8941.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="9651"/>
          <seriesInfo name="DOI" value="10.17487/RFC9651"/>
        </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"/>
            <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="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"/>
            <abstract>
              <t>RFC 2119 specifies common key words that may be used in protocol specifications. This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.</t>
            </abstract>
          </front>
          <seriesInfo name="BCP" value="14"/>
          <seriesInfo name="RFC" value="8174"/>
          <seriesInfo name="DOI" value="10.17487/RFC8174"/>
        </reference>
      </references>
      <references anchor="sec-informative-references">
        <name>Informative References</name>
        <reference anchor="TARGETED">
          <front>
            <title>Targeted HTTP Cache Control</title>
            <author fullname="S. Ludin" initials="S." surname="Ludin"/>
            <author fullname="M. Nottingham" initials="M." surname="Nottingham"/>
            <author fullname="Y. Wu" initials="Y." surname="Wu"/>
            <date month="June" year="2022"/>
            <abstract>
              <t>This specification defines a convention for HTTP response header fields that allow cache directives to be targeted at specific caches or classes of caches. It also defines one such header field, the CDN-Cache-Control response header field, which is targeted at content delivery network (CDN) caches.</t>
            </abstract>
          </front>
          <seriesInfo name="RFC" value="9213"/>
          <seriesInfo name="DOI" value="10.17487/RFC9213"/>
        </reference>
      </references>
    </references>
    <?line 179?>

<section anchor="acknowledgements">
      <name>Acknowledgements</name>
      <t>Thanks to Stephen Ludin for his review and suggestions.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAAAAAAAAA+1Z624bxxX+v08xlYHCKriUKbtpzKRJFFmOhMqSqguCIAiC
4e5wOdXuznpmVjQjKM/SZ+mT9TtnZsldSnHboEVRoAYskXM5c67fuShN08Rr
X6qpOL6+vhCHMlso8Y01beMSOZtZdTdNcpPVssKR3Mq5T7Xy83ThfTPTLs3o
QlrwhfTFqySXHgfv3xxcHz0kGb4Uxq6mwvk8SXRjp8Lb1vn9Fy9ev9hPbtVq
aWwe3h7x47ouRuKkvpOlBilt6gQnbpl+OJZIq+RUfKtmQtY5jnpla+XFtZW1
a4z1SeI8dn6UpanBykq5xFXS+h/ft8YrNxW1SRo9Fd97k40Efug6V7UfCYfL
Vs0dPq2q+MFbnWErM1Uj44cKh7Gl61LX6ockuVN1q6aJEH0mhfCrBq9/C+Yh
UtAoVheG9EjKc9O9Pfq9LMbGFnvYq6Qup2Kt3XRZfLV8SZvYkzZbbO6V2nk3
Dpt7B9jSd8rtXbSzUmd7fQJE1qrGbK4W2i/a2RhyxNf5V6o+eFU7qNvtlXKm
SrfXN2wSbqXauValfGAqBgcS2fqFsVBDiicFtANFvxuLM+M95F/IipeDG72T
9nZ7B5LIWv/EJp/ySmNgxzJ8FiIVF1YuYGP+npm29uRXB3AmC1+RvKyCCqva
+K/oxxiOwRut1RsVLJfLcbe7lyS1sRWevWMbkvGm4vLt4evJ5EX8nh4eHB6f
nH3TrU+wfnV9eXN4fXN59CZ9e3J0+uYqbH7y+wncvJ73SV4fXH5zdH30JpzY
n7xMEniQ9ivavDo6fTsVO9gRNf7tJEmapkLOSKoMrny90E64RmV6rjNWDlTr
rcnbTDkhRaXg9cLMRa5cZvWMfM0jgq0q+bRb6MaJmfJ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