<?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.17 (Ruby 3.3.1) -->
<?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-02" category="std" consensus="true" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.21.0 -->
  <front>
    <title>HTTP Cache Groups</title>
    <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-cache-groups-02"/>
    <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/>
    <keyword>Internet-Draft</keyword>
    <abstract>
      <?line 46?>

<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 50?>

<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 a set of stored responses in HTTP caches by associating them with one or more 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 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 this 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 have 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>The 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, a POST request that has side effects on two cache groups 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>
      <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="Mark Nottingham" initials="M." surname="Nottingham">
              <organization>Cloudflare</organization>
            </author>
            <author fullname="Poul-Henning Kamp" initials="P." surname="Kamp">
              <organization>The Varnish Cache Project</organization>
            </author>
            <date day="21" month="April" 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 that wish to use a common
   syntax that is more restrictive than traditional HTTP field values.

   This document obsoletes RFC 8941.

              </t>
            </abstract>
          </front>
          <seriesInfo name="Internet-Draft" value="draft-ietf-httpbis-sfbis-06"/>
        </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 177?>

<section anchor="acknowledgements">
      <name>Acknowledgements</name>
      <t>Thanks to Stephen Ludin for his review and suggestions.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAAAAAAAAA+1Z627jxhX+z6eYaoFiXZjyyrtos0qaxLG9sVGv7fqCIgiC
YESOqKlJDjMztFYxnGfps/TJ+p0zQ4mUnU2bFigKdIG1pbmcOdfvXJymaeK1
L9VUnNzcXIpDmS2U+NqatnGJnM2sup8muclqWeFIbuXcp1r5ebrwvplpl2Z0
IS34QvpqP8mlx8GHo4Ob48ckw5fC2NVUOJ8niW7sVHjbOr//6tVbHL5Tq6Wx
+VSc1l7ZWvn0iF5IEudlnX8vS1OD2Eq5xFXS+u9/aI1XbipqkzR6Kr71JtsV
+KHrXNV+VzhjvVVzh0+rKn7wVmfYykzVyPihwmFs6brUtfouSe5V3appIgSL
ETSBb37V4PW/GHun6yLoBKsLQ5og8d10b49+L4uxscUe9iqpy6lY6yddFl8u
X9Mm9qTNFpt7pXbejcPm3gG29L1ye5ftrNTZXp8AkbWqMZurhfaLdjaGHPF1
/pWqD17VTpva7ZVypkq31zdNEm6l2rlWpXxgKgYHEtn6hbFQQ4onBbQDRb8f
i3PjPeRfyIqXgyO8l/ZueweSyFr/KD14mPJKY2DHMnwWIhWXVi6srPl7Ztra
k2ccwB2sLLXkZRVUWNXGf0k/xnAK3mit3qhguVyOu929JKmNrfDsPduQjDcV
V+8O304mr+L39PDg8OT0/OtufYL165ur28Ob26vjo/Td6fHZ0TW8MD0aD5zb
zfETflvP+y/cHFx9fXxzfBSo7U9eJwkcSvsVbV4fn72bihF2RI1/oyRJ01TI
GQmZwbNvFtoJ16hMz3XGuoKmvTV5myknpKiUrJ0wc5Erl1k9I9fzCEmrSj7t
FrpxYqb8Uqka3m2syrHpGmyBgK5DHLNp4eMjti6IjIhKJWYrIZ1DxEgyHd7b
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