<?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.26 (Ruby 3.3.6) -->
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" ipr="trust200902" docName="draft-deletecookie-weiss-http-00" category="info" consensus="true" submissionType="IETF" tocInclude="true" sortRefs="true" symRefs="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.28.0 -->
  <front>
    <title abbrev="DelCookie">Delete-Cookie</title>
    <seriesInfo name="Internet-Draft" value="draft-deletecookie-weiss-http-00"/>
    <author fullname="Yoav Weiss">
      <organization>Shopify</organization>
      <address>
        <email>yoav@yoav.ws</email>
      </address>
    </author>
    <date year="2025" month="March" day="20"/>
    <keyword>next generation</keyword>
    <keyword>unicorn</keyword>
    <keyword>sparkling distributed ledger</keyword>
    <abstract>
      <?line 45?>

<t>This document specifies a <tt>Delete-Cookie</tt> HTTP header that instructs clients to delete cookies of certain names,
without requiring the server to know more details about them.</t>
    </abstract>
    <note removeInRFC="true">
      <name>About This Document</name>
      <t>
        The latest revision of this draft can be found at <eref target="https://yoavweiss.github.io/delete-cookie/draft-deletecookie-weiss-http.html"/>.
        Status information for this document may be found at <eref target="https://datatracker.ietf.org/doc/draft-deletecookie-weiss-http/"/>.
      </t>
      <t>Source for this draft and an issue tracker can be found at
        <eref target="https://github.com/yoavweiss/delete-cookie"/>.</t>
    </note>
  </front>
  <middle>
    <?line 50?>

<section anchor="introduction">
      <name>Introduction</name>
      <t>Long-operating web sites can often find themselves dealing with "cookie cruft" -
cookies that no longer have backend logic that corresponds with them.</t>
      <t>Such cookies may have been set at some point in the past with
far-reaching expiration dates, and are now causing useless cookie bloat at
best, or using up quotas at the expense of relevant cookies at worst</t>
      <t>Deleting cookies is possible today by setting their expiry date to one in the past,
but that requires one to know the "domain" and "path" parameters with which the cookies were set.
That is not something that can be passively observed on the server side by default.</t>
      <t>This draft proposes a new <tt>Delete-Cookie</tt> header which will enable servers to instruct clients
to delete cookies of a certain name from their cookie stores.</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 document uses the following terminology from Section 3 of <xref target="STRUCTURED-FIELDS"/> to specify syntax and parsing: Lists, strings.</t>
      </section>
    </section>
    <section anchor="delete-cookie">
      <name>Delete-Cookie</name>
      <t>The Delete-Cookie response header is a Structured Field <xref target="STRUCTURED-FIELDS"/> List of strings.
Each string represents a cookie <xref target="COOKIES"/> name to be deleted.</t>
      <t>A user agent that receives a Delete-Cookie response header <bcp14>MUST</bcp14> process it before any Set-Cookie headers received as part of the same response.</t>
      <t><em>Note:</em> The relevant processing needs to happen before step 15 of the <eref target="https://fetch.spec.whatwg.org/#http-network-fetch">network fetch</eref> algorithm.</t>
      <t>When receiving a Delete-Cookie response header, the user agent <bcp14>MUST</bcp14>:</t>
      <ol spacing="normal" type="1"><li>
          <t>If the response was not delivered over a "secure" connection (as defined by the user agent) <xref target="COOKIES"/>, return.</t>
        </li>
        <li>
          <t>Let <tt>host</tt> be the canonicalized response URL's host name.</t>
        </li>
        <li>
          <t>Let <tt>parsed</tt> be the result of parsing the header's value as a List, as per <xref target="STRUCTURED-FIELDS"/>, Section 4.2.1.</t>
        </li>
        <li>
          <t>If parsing fails, return.</t>
        </li>
        <li>
          <t>For each <tt>name</tt> in <tt>parsed</tt>:
          </t>
          <ol spacing="normal" type="1"><li>
              <t>If <tt>name</tt> is not a String <xref target="STRUCTURED-FIELDS"/>, continue.      </t>
              <t><em>Note:</em> The above ignores any parameters in the header's value List.</t>
            </li>
            <li>
              <t>Let <tt>matching cookies</tt> be the set of cookies from the user agent's cookie store that meet all the following requirements:
              </t>
              <ol spacing="normal" type="1"><li>
                  <t>The cookie's name is <tt>name</tt>.</t>
                </li>
              </ol>
              <t>
<em>Note:</em> This ensures that cookies with an empty name can be deleted using the empty string. It also ensures that multiple cookies with the same name (and different paths, domains or other attributes) will all be deleted.      </t>
              <ol spacing="normal" type="1"><li>
                  <t>Either of the following is true:
                  </t>
                  <ol spacing="normal" type="1"><li>
                      <t>The cookie's host-only-flag is true, and the cookie's domain is identical to host.</t>
                    </li>
                  </ol>
                  <t>
<em>Note:</em> The ensures that a server can't delete host-only cookies that aren't destined to its host.          </t>
                  <ol spacing="normal" type="1"><li>
                      <t>The cookie's host-only-flag is false, and the cookie's domain domain-matches host, as per <xref target="COOKIES"/>, Section 5.1.3.</t>
                    </li>
                  </ol>
                </li>
              </ol>
            </li>
            <li>
              <t>For each cookie in matching cookies:
              </t>
              <ol spacing="normal" type="1"><li>
                  <t>Remove cookie from the user agent's cookie store.</t>
                </li>
              </ol>
            </li>
          </ol>
        </li>
      </ol>
      <section anchor="example">
        <name>Example</name>
        <t>MegaCorp servers receive a request from a client with the following header:</t>
        <sourcecode type="http-message"><![CDATA[
Cookie: foo=bar, fizz=baz
]]></sourcecode>
        <t>The server operators know that cookies named "foo" and "fizz" are no longer meaningful for their service, and are unaware when and how those cookies were set.
In order to clear that user's cookie store, they send the following header:</t>
        <sourcecode type="http-message"><![CDATA[
Delete-Cookie: "foo", "fizz"
]]></sourcecode>
        <t>That clears the client's cookie store of "foo" and "fizz" and ensures that these cookies won't be sent again.</t>
      </section>
    </section>
    <section anchor="security-considerations">
      <name>Security Considerations</name>
      <t>The Delete-Cookie header enables servers to delete cookies from user agents on their own registrable domains.
These servers could have already deleted these same cookies by setting cookies with identical name, path and domain with an expiration date of 0.
As such the header does not provide servers any new capabilities, beyond the convenience of not having to know the path and domain of a cookie in order to delete it.</t>
    </section>
    <section anchor="iana-considerations">
      <name>IANA Considerations</name>
      <section anchor="header-field-registration">
        <name>Header Field Registration</name>
        <t>IANA is asked to update the
"Hypertext Transfer Protocol (HTTP) Field Name Registry" registry maintained at
&lt;<eref target="https://www.iana.org/assignments/http-fields/http-fields.xhtml"/>&gt; according
to the table below:</t>
        <table>
          <thead>
            <tr>
              <th align="left">Field Name</th>
              <th align="left">Status</th>
              <th align="left">Reference</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left">Delete-Cookie</td>
              <td align="left">permanent</td>
              <td align="left">
                <xref target="delete-cookie"/> of this document</td>
            </tr>
          </tbody>
        </table>
      </section>
    </section>
  </middle>
  <back>
    <references anchor="sec-normative-references">
      <name>Normative References</name>
      <reference anchor="STRUCTURED-FIELDS" target="https://datatracker.ietf.org/doc/draft-ietf-httpbis-sfbis/">
        <front>
          <title>Structured Field Values for HTTP</title>
          <author>
            <organization/>
          </author>
          <date year="2024" month="May"/>
        </front>
      </reference>
      <reference anchor="COOKIES" target="https://datatracker.ietf.org/doc/draft-ietf-httpbis-rfc6265bis/">
        <front>
          <title>Cookies HTTP State Management Mechanism</title>
          <author>
            <organization/>
          </author>
          <date year="2025" month="February"/>
        </front>
      </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>
    <?line 166?>

<section numbered="false" anchor="acknowledgments">
      <name>Acknowledgments</name>
      <t>Thanks to Anne van Kesteren and Pat Meenan for their feedback on early versions of this proposal.</t>
    </section>
  </back>
  <!-- ##markdown-source:
H4sIAAAAAAAAA7VY23LcNhJ951dgRw+2U+LIku1sdspxMitLsSq6eHVZl8uV
KoEkOESJAzAAqPFYsr8l37JftqcBkDOUFHurtjIPEi9Ao/v06RvTNE2cdLWY
sNFrUQsn0l2tr6QYJTzLjLgOz7tnOXdips1ywqQqdZIUOld8js2F4aVLCy8h
94vThZDWppVzTfr0aWLbbI57qZVbNthwsHe+n6h2ngkzSQqInSS5VlYo29oJ
c6YVCc5+lmwwbgSfsOnp3hQ3C22uZka3zYS9+4W9w51UM/YLPUmuxBKvi0nC
UqbER8dmQgnDHc6kR62SuTb+0jbcXNW0s5DWGZm1ThSsFsVMmORaqBbabDDW
H0Q3Qe3hiXg857KmJT+Lj3ze1GKc6zk95yavJoyst5OtrbWXWxAH0dJVbQZw
l5pfe6S2AnhpHqFmrAYq1mFNJ6VfOw7bx1IPd2191Q3jys3rUZLw1lXaEEw4
hLGyrevgxPeQz97Rev9CmxlX8pMHcMLOKt3IcunfiGA16fMz/RkvbKK0mWPp
NaBj7Oz89GL3/OJ073W6f7B3+Pps4vdFpp3BvblrDTDfl6Iu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