<?xml version="1.0" encoding="UTF-8"?>
  <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
  <!-- generated by https://github.com/cabo/kramdown-rfc version 1.7.21 (Ruby 2.6.10) -->


<!DOCTYPE rfc  [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">

]>


<rfc ipr="trust200902" docName="draft-tulshibagwale-wimse-crest-00" category="info" submissionType="IETF" xml:lang="en">
  <front>
    <title abbrev="crest">The Contextualized REST Architecture</title>

    <author initials="A." surname="Tulshibagwale" fullname="Atul Tulshibagwale">
      <organization>SGNL</organization>
      <address>
        <email>atul@sgnl.ai</email>
      </address>
    </author>

    <date year="2024" month="November" day="21"/>

    <area>sec</area>
    <workgroup>wimse</workgroup>
    <keyword>Microservices</keyword> <keyword>REST</keyword> <keyword>APIs</keyword> <keyword></keyword>

    <abstract>


<?line 56?>

<t>The REST architecture is extremely popular in modern computing environments. A benefit it provides is that each request can be serviced by independent server side components such as different instances of web servers or different instances of serverless request handlers.</t>

<t>The lack of any context associated with a request means that the client has to provide the entire context with every request. In monolithic server-side architectures the client typically only provides an identifier to a previously established "session" on the server side, which is retrieved from a persistent storage such as a database.</t>

<t>However, this strategy often does not work in microservices architectures, where the persistent storage may be many hops away from the server-side components that handle the incoming REST API requests. As a result, REST APIs are used between services and each request is required to carry large context including tokens such as Transaction Tokens <xref target="TRATS"/> (which assure the identity and context of each request), SPIFFE <xref target="SPIFFE"/> tokens (which assures the service identity) and possibly other context.</t>

<t>The Contextualized REST (CREST) architecture adds a cached context to REST, with mechanisms to negotiate the establishment of the context when it is not found. Each request can refer to the context items it depends upon instead of carrying the entire context with the request. The server can accept the reference to the context item or respond with a specific error to prompt the client to reestablish the context. Clients can create new or delete existing context items in separate requests or as a part of other requests.</t>

<t>The CREST architecture assumes the server holds the context across different requests in a server-side cache. Such a cache may be typically shared across various applications and services within a VPC or a data center. The possibility that subsequent requests from the same client will reach different VPCs or data centers is low, thus providing an efficiency optimization for the vast majority of requests.</t>



    </abstract>

    <note title="About This Document" removeInRFC="true">
      <t>
        The latest revision of this draft can be found at <eref target=""/>.
        Status information for this document may be found at <eref target="https://datatracker.ietf.org/doc/draft-tulshibagwale-wimse-crest/"/>.
      </t>
      <t>Source for this draft and an issue tracker can be found at
        <eref target="https://github.com/SGNL-ai/crest"/>.</t>
    </note>


  </front>

  <middle>


<?line 68?>

<section anchor="introduction"><name>Introduction</name>

<t>The REST architecture has been very successful and used almost universally in modern computing environments. However, it requires each request to carry the entire context of the request so that the server servicing the HTTP request can process it. A benefit of this approach is that each request from the same client can be serviced by different server-side instances, thereby making it easier to load-balance and provide better availability, reliability and response-time characteristics. As the amount of data in the context grows, this strategy, however, causes each request to be more expensive in terms of the network traffic and creates latency of its own.</t>

<t>The Contextualized REST (CREST) architecture addresses this by enabling HTTP servers to cache independently addressed context items. One or more server-side instances can share the same cache, making it more efficient than carrying the context with each request. At the same time, the CREST architecture enables different collections of server-side instances to have different caches. This enables geographically or network separated instances to maintain different caches.</t>

</section>
<section anchor="the-context-cache"><name>The Context Cache</name>
<t>The Context Cache (CC) is an abstraction that assumes one or more server side components can access a cache which can hold context across requests.</t>

<section anchor="cached-items"><name>Cached Items</name>
<t>The CC is organized as a collection of independent items. Each item can be created, read, updated and deleted independently. Items may expire at any time. Each Item is identified by a unique identifier called <spanx style="verb">CCII</spanx> (Context Cache Item Identifier). The CCII format is a Base64 encoded with URL and Filename Safe Alphabet as described in RFC4648 <xref target="RFC4648"/>.</t>

</section>
</section>
<section anchor="ccii-header"><name>CCII Header</name>
<t>When a client wants to make a request by referencing a CC Item, it includes a header named <spanx style="verb">CCII</spanx> in the request. The value of this header is a comma separated list of CCIIs.</t>

<figure title="Non-normative example of a CCII Request Header" anchor="fig-ccii-header"><sourcecode type="HTTP"><![CDATA[
CCII  ccii1, ccii2, ccii3
]]></sourcecode></figure>

</section>
<section anchor="crest-request"><name>Contextualized REST HTTP Request</name>
<t>A contextualized REST HTTP Request includes exactly one CCII header <xref target="ccii-header"/> that references the Context Cache Items that it depends upon.</t>

<section anchor="cache-miss"><name>Cache Miss</name>
<t>If the HTTP server is unable to find the Context Cache Item referenced in a CREST Request <xref target="crest-request"/>, it MUST return the status code <spanx style="verb">424</spanx> (Failed Dependency) to the HTTP client. The body of the HTTP response SHOULD contain the <spanx style="verb">MISSED-CCII</spanx> header. The value of this header MUST be a comma separated list of one or more items that were not found in the cache.</t>

<figure title="Non-normative example of a MISSED-CCII Response Header" anchor="fig-missed-ccii-header"><sourcecode type="HTTP"><![CDATA[
MISSED-CCII ccii1, ccii2
]]></sourcecode></figure>

</section>
</section>
<section anchor="context-cache-operations"><name>Context Cache Operations</name>
<t>A HTTP client MAY create or delete a CC Item. These operations are done by including specific headers in the HTTP request and obtaining specific headers in the HTTP response.</t>

<section anchor="create-cc-items"><name>Create CC Items</name>
<t>To create a CC Item, the HTTP client includes the request header named <spanx style="verb">CC-CreateItems</spanx>. The value of the <spanx style="verb">CC-CreateItems</spanx> header is a comma separated list of URL Safe Base64 <xref target="RFC4648"/> encoding of the values to be inserted into the CC. If zero or more of the specified values already exist in the CC or if the HTTP server creates one or more of the specified values in the CC, it includes the <spanx style="verb">CCII</spanx> header in the response, and sets its value to the CCII of the item specified in the request.</t>

<t>The HTTP client MUST accept the CCII headers in all responses with status codes except responses that have the status codes greater than 499.</t>

<figure title="Non-normative example of a CCII-CreateItem Request Header" anchor="fig-createitem-request"><sourcecode type="HTTP"><![CDATA[
CC-CreateItems abc123-efg456_,789hij_012,asdkflkau3
]]></sourcecode></figure>

<figure title="Non-normative example of a CCII Response Header" anchor="fig-createitem-response"><sourcecode type="HTTP"><![CDATA[
CCII ccii3,ccii4
]]></sourcecode></figure>

</section>
<section anchor="delete-cc-items"><name>Delete CC Items</name>
<t>To delete a CC Item, the HTTP client includes the request header named <spanx style="verb">CC-DeleteItems</spanx>. The value of the <spanx style="verb">CC-DeleteItems</spanx> header is a comma separated list of CCIIs. The HTTP Server MAY delete the requested CC Items. The HTTP Server confirms the deletion by including a <spanx style="verb">Deleted-CCII</spanx> header in the HTTP response.</t>

<figure title="Non-normative example of a CCII-DeleteItem Request Header" anchor="fig-deleteitem-request"><sourcecode type="HTTP"><![CDATA[
CC-DeleteItems ccii1,ccii3
]]></sourcecode></figure>

<figure title="Non-normative example of a Deleted-CCII Response Header" anchor="fig-deleteitem-response"><sourcecode type="HTTP"><![CDATA[
Deleted-CCII ccii1
]]></sourcecode></figure>

</section>
</section>
<section anchor="architecture-notes"><name>Architecture Notes</name>
<t>This is a non-normative section.</t>

<t>The CREST architecture enables a pool of HTTP server components to share a cache and a request received at any one in the pool to reference the cache. This can be achieved in today's computing environments within the limits of a VPC or a data center.</t>

<t>Since most client requests would route to the same data center, this strategy can provide improved efficiency over the requirement to pass the entire context with each request.</t>

</section>


  </middle>

  <back>


<references title='References' anchor="sec-combined-references">

    <references title='Normative References' anchor="sec-normative-references">



<reference anchor="RFC4648">
  <front>
    <title>The Base16, Base32, and Base64 Data Encodings</title>
    <author fullname="S. Josefsson" initials="S." surname="Josefsson"/>
    <date month="October" year="2006"/>
    <abstract>
      <t>This document describes the commonly used base 64, base 32, and base 16 encoding schemes. It also discusses the use of line-feeds in encoded data, use of padding in encoded data, use of non-alphabet characters in encoded data, use of different encoding alphabets, and canonical encodings. [STANDARDS-TRACK]</t>
    </abstract>
  </front>
  <seriesInfo name="RFC" value="4648"/>
  <seriesInfo name="DOI" value="10.17487/RFC4648"/>
</reference>



    </references>

    <references title='Informative References' anchor="sec-informative-references">

<reference anchor="REST" target="https://ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm">
  <front>
    <title>Representational State Transfer (REST)</title>
    <author initials="R. T." surname="Fielding" fullname="Roy Thomas Fielding">
      <organization></organization>
    </author>
    <date year="n.d."/>
  </front>
</reference>
<reference anchor="SPIFFE" target="https://spiffe.io/docs/latest/spiffe-about/overview/">
  <front>
    <title>Secure Production Identity Framework for Everyone</title>
    <author >
      <organization>Cloud Native Computing Foundation</organization>
    </author>
    <date year="n.d."/>
  </front>
</reference>
<reference anchor="TRATS" target="https://datatracker.ietf.org/doc/draft-ietf-oauth-transaction-tokens/">
  <front>
    <title>Transaction Tokens</title>
    <author initials="A." surname="Tulshibagwale" fullname="Atul Tulshibagwale">
      <organization>SGNL</organization>
    </author>
    <author initials="G." surname="Fletcher" fullname="George Fletcher">
      <organization>Capital One</organization>
    </author>
    <author initials="P." surname="Kasselman" fullname="Pieter Kasselman">
      <organization>SPIRL</organization>
    </author>
    <date year="n.d."/>
  </front>
</reference>


    </references>

</references>


<?line 139?>

<section numbered="false" anchor="Acknowledgements"><name>Acknowledgements</name>

</section>


  </back>

<!-- ##markdown-source:
H4sIALKBP2cAA51ZbXPbNhL+zl+BsT9cM2PKaerrNZrpzPlcu9Fcknps927u
UwKRoISaJHQAKMX1OL/9nl2AFCjJubSZjC2TwGJfnn12F8rzPHNetuUHWZtW
TYW3ncr0yvIn51+9fPn65auskH4qdFsZcSwulqq4z1w3b7Rz2rT+YYV9s8u7
q0xaJafCqSLbLKZioxunsqw0RSsbLCmtrHzuu9ot9VwuNrJWOa/JC6ucz1++
zNaq7dQ0E2Kh/bKbT8XR7c/v3+ZSn/KSI7yppccnvDnKMq99DcF3SyUuoIj6
5DtZ699VKW4ub+/EuS2W2qvCd1Zlcj63aj0VLCirZQsNVZvdb+i4XLzThTVO
2bUulOMnJII/nF/PwpMsOxYljp+KPOcPQjtR6brGgboVsvOmkV4Xsq4fxPxB
fGrqV7YqhK5EazxsgnkZVi2NnWY5tripOJ+Iu9QjOCh46xyO2ntlLLQml+Cz
aqSup0Ji3d/doq0nUmdZayypsGYn3lxdnH1/9sMUQfuHhJvfi8u2MKVuFy7L
KJrpWlhLv4WITr1RK3hKtR5LTCtrcevJ4jsrW1cpK76hHS/CDmkXCiFZer9y
09NTXbhJV+iJKrvTz5VWNR15uurm7rQEZpQNMk8pEh8kgvTB+YdaTZa+YXm9
i+hzHt1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