<?xml version="1.0" encoding="utf-8"?>
<!-- name="GENERATOR" content="github.com/mmarkdown/mmark Mmark Markdown Processor - mmark.miek.nl" -->
<rfc version="3" ipr="trust200902" docName="draft-ietf-regext-rdap-referrals-02" submissionType="IETF" category="std" xml:lang="en" xmlns:xi="http://www.w3.org/2001/XInclude" indexInclude="true" consensus="true">

<front>
<title abbrev="Efficient RDAP Referrals">Efficient RDAP Referrals</title><seriesInfo value="draft-ietf-regext-rdap-referrals-02" stream="IETF" status="standard" name="Internet-Draft"></seriesInfo>
<author fullname="Gavin Brown"><organization>ICANN</organization><address><postal><street>12025 Waterfront Drive, Suite 300</street>
<city>Los Angeles</city>
<code>90292</code>
<country>US</country>
<region>CA</region>
</postal><email>gavin.brown@icann.org</email>
<uri>https://icann.org</uri>
</address></author><author fullname="Andy Newton"><organization>ICANN</organization><address><postal><street>12025 Waterfront Drive, Suite 300</street>
<city>Los Angeles</city>
<code>90292</code>
<country>US</country>
<region>CA</region>
</postal><email>andy.newton@icann.org</email>
<uri>https://icann.org</uri>
</address></author><date/>
<area>Internet</area>
<workgroup>Registration Protocols Extensions (regext)</workgroup>

<abstract>
<t>This document describes an RDAP extension that allows RDAP clients to request to
be referred to a related RDAP record for a resource.</t>
</abstract>

</front>

<middle>

<section anchor="introduction"><name>Introduction</name>
<t>Many Registration Data Access Protocol (RDAP, described in <xref target="RFC7480"></xref>,
<xref target="RFC7481"></xref>, <xref target="RFC9082"></xref>, <xref target="RFC9083"></xref> and others) resources contain links to
related RDAP resources.</t>
<t>For example, in the domain space, an RDAP record for a domain name received from
the registry operator may include a link for the RDAP record for the same
object provided by the sponsoring registrar (for example, see
<xref target="gtld-rdap-profile"></xref>), while in the IP address space, an RDAP record for an
address allocation may include links to enclosing or sibling prefixes.</t>
<t>In both cases, RDAP service users are often equally if not more interested in
these related RDAP resources than the resource provided by the TLD registry or
RIR.</t>
<t>While RDAP supports redirection of RDAP requests using HTTP redirections (which
use a <tt>3xx</tt> HTTP status and the &quot;<tt>Location</tt>&quot; header field, see Section 15.4 of
<xref target="RFC9110"></xref>), it is not possible for RDAP servers to know <em>a priori</em> whether a
client requesting an RDAP record is doing so because it wants to retrieve a
related RDAP record, or its own, so it can only respond by providing the full
RDAP response. The client must then parse that response in order to extract the
relevant URL from the &quot;<tt>links</tt>&quot; property of the object.</t>
<t>This results in the wasteful expenditure of time, compute resources and
bandwidth on the part of both the client and server.</t>
<t>This document describes an extension to RDAP that allows clients to request that
an RDAP server refer them to the URL of a related resource.</t>
</section>

<section anchor="rdap-referral-request"><name>RDAP Referral Request</name>
<t>To request a referral to a related resource, the client sends an HTTP <tt>GET</tt>
request to the RDAP server with a path of the form:</t>

<artwork><![CDATA[<base path>referrals0_ref/<relation><lookup path>
]]></artwork>
<t>The client replaces <tt>&lt;base path&gt;</tt> with the path component of the RDAP server's
base URL (which, as per <xref target="RFC9224"></xref>, has a trailing <tt>/</tt> character),
<tt>&lt;lookup path&gt;</tt> with the lookup path of the object being sought, and
<tt>&lt;relation&gt;</tt> with the desired relationship type.</t>
<t>For example, the path of a referral query for the domain <tt>example.com</tt> sent to
an RDAP server whose base path is <tt>/</tt> would be:</t>

<artwork><![CDATA[/referrals0_ref/related/domain/example.com
]]></artwork>
<t>The referral query for the parent network of <tt>192.0.2.42</tt> would have the
following full path:</t>

<artwork><![CDATA[/referrals0_ref/rdap-up/ip/192.0.2.42
]]></artwork>
<t>Lookup paths for domain names, IP networks, autonomous system numbers,
nameservers, and entities are described in <xref target="RFC9082"></xref>. Lookups defined by RDAP
extensions may also use this extension.</t>
<t>Referral requests for searches, where more than one object is returned, and help
queries, as described by <xref target="RFC9083"></xref>, are not supported. Servers MUST return an
HTTP 400 for these requests.</t>
</section>

<section anchor="rdap-referral-response"><name>RDAP Referral Response</name>
<t>If the object specified in the request exists, a single appropriate link exists,
and the client is authorised to perform the request, the server response
<bcp14>MUST</bcp14>:</t>

<ol>
<li><t>have an HTTP status code of 301 (Moved Permanently), 302 (Found), 303 (See
Other), or 307 (Temporary Redirect); and</t>
</li>
<li><t>include an HTTP <tt>Location</tt> header field, whose value contains the URL of the
linked resource.</t>
</li>
</ol>
<t>If the server cannot find an appropriate link, the response <bcp14>MUST</bcp14> have an
HTTP status of 404.</t>
<t>If an RDAP server holds in its datastore more than one relationship type for
an object, a scenario that is possible but not common, only one of the URLs, as
determined by server policy, can be returned.</t>
<t>The following examples use the HTTP/1.1 message exchange syntax as seen in
<xref target="RFC9110"></xref>.</t>
<t>An example of a referral request from a domain registry to a domain registrar:</t>

<artwork><![CDATA[Client Request:

GET /referrals0_ref/related/domain/example.com HTTP/1.1
Accept: application/rdap+json

Server Response:

HTTP/1.1 307 Temporary Redirect
Location: https://registrar.example/domain/example.com
]]></artwork>
<t>An example of a referral request for a parent IPv4 network:</t>

<artwork><![CDATA[Client Request:

GET /referrals0_ref/rdap-up/ip/192.0.2.42 HTTP/1.1
Accept: application/rdap+json

Server Response:

HTTP/1.1 307 Temporary Redirect
Location: https://rir.example/ip/192.0.2.0/24
]]></artwork>
<t>An example of a referral request for a parent IPv6 network:</t>

<artwork><![CDATA[Client Request:

GET /referrals0_ref/rdap-up/ip/2001%3adb8%3a%3a1 HTTP/1.1
Accept: application/rdap+json"

Server Response:

HTTP/1.1 307 Temporary Redirect
Location: https://rir.example/ip/2001%3adb8%3a%3a/32
]]></artwork>

<section anchor="selecting-the-appropriate-link"><name>Selecting The Appropriate Link</name>
<t>When the server receives a referral request, it must select which of an object's
links it should use to construct the response.</t>
<t>The <tt>rel</tt> property of the selected link <bcp14>MUST</bcp14> match <tt>&lt;relation&gt;</tt> path
segment of the request. The <tt>type</tt> and <tt>hreflang</tt> properties of the link, if
present, <bcp14>MUST</bcp14> match the <tt>Accept</tt> and (if specified) <tt>Accept-Language</tt> header
fields of the request.</t>
</section>

<section anchor="caching-by-intermediaries"><name>Caching by Intermediaries</name>
<t>To facilitate caching of RDAP resources by intermediary proxies, servers which
provide a referral based on the value of the <tt>Accept</tt> header field in the
request <bcp14>MUST</bcp14> include a <tt>Vary</tt> header field (See Section 12.5.5 of
<xref target="RFC9110"></xref>) in the response. This field <bcp14>MUST</bcp14> include <tt>accept</tt>, and <bcp14>MAY</bcp14>
include other header field names.</t>
<t>Example:</t>

<artwork><![CDATA[Vary: accept, accept-language
]]></artwork>
</section>

<section anchor="client-processing-of-referral-responses"><name>Client Processing of Referral Responses</name>
<t>Note that as per Section 10.2.2 of [!@RFC9110], the URI-reference in <tt>location</tt>
header fields <bcp14>MAY</bcp14> be relative. For relative references, RDAP clients
<bcp14>MUST</bcp14> compute the full URI using the request URI.</t>
</section>
</section>

<section anchor="rdap-conformance"><name>RDAP Conformance</name>
<t>Servers which implement this specification <bcp14>MUST</bcp14> include the string
&quot;<tt>referrals0</tt>&quot; in the &quot;<tt>rdapConformance</tt>&quot; array in all RDAP responses.</t>
</section>

<section anchor="iana-considerations"><name>IANA Considerations</name>
<t>IANA is requested to register the following value in the RDAP Extensions
Registry:</t>
<t><strong>Extension identifier:</strong> <tt>referrals0</tt></t>
<t><strong>Registry operator:</strong> any.</t>
<t><strong>Published specification:</strong> this document.</t>
<t><strong>Contact:</strong> the authors of this document.</t>
<t><strong>Intended usage:</strong> this extension allows clients to request to be referred to a
related resource for an RDAP resource.</t>
</section>

<section anchor="security-considerations"><name>Security Considerations</name>
<t>A malicious HTTP redirect has the potential to create an infinite loop, which
can exhaust resources on both client and server side.</t>
<t>To prevent such loops, RDAP servers which receive referral requests for the
<tt>self</tt> relation <bcp14>MUST</bcp14> respond with a 400 HTTP status.</t>
<t>As described in Section 15.4 of [!@RFC9110], when processing server responses,
RDAP clients <bcp14>SHOULD</bcp14> detect and intervene in cyclical redirections.</t>
</section>

<section anchor="change-log"><name>Change Log</name>
<t>This section is to be removed before publishing as an RFC.</t>

<section anchor="changes-from-01-to-02"><name>Changes from 01 to 02</name>

<ul>
<li><t>Add reference to <xref target="gtld-rdap-profile"></xref> which describes how gTLD RDAP servers
link to registrar RDAP resoures.</t>
</li>
<li><t>Include <tt>&lt;base path&gt;</tt> in the path specification, and remove the <tt>/</tt> between
<tt>&lt;relation&gt;</tt> and <tt>&lt;lookup path&gt;</tt> so that naive URL construction works.</t>
</li>
<li><t>Reuse the language from RFC 7480 on HTTP status codes used for redirection.</t>
</li>
<li><t>Fix HTTP status code in the examples.</t>
</li>
<li><t>Described the risk of redirection loops and things clients and servers have to
do.</t>
</li>
</ul>
</section>

<section anchor="changes-from-00-to-01"><name>Changes from 00 to 01</name>

<ul>
<li><t>Switch to using a path segment and a 30x redirect.</t>
</li>
<li><t>Describe how the server behaves when multiple links exist.</t>
</li>
</ul>
</section>

<section anchor="changes-from-draft-brown-rdap-referrals-02-to-draft-ietf-regext-rdap-referrals-00"><name>Changes from draft-brown-rdap-referrals-02 to draft-ietf-regext-rdap-referrals-00</name>

<ul spacing="compact">
<li>Nothing apart from the name.</li>
</ul>
</section>

<section anchor="changes-from-01-to-02-1"><name>Changes from 01 to 02</name>

<ul spacing="compact">
<li>add this change log.</li>
</ul>
</section>

<section anchor="changes-from-00-to-01-1"><name>Changes from 00 to 01</name>

<ul spacing="compact">
<li>change extension identifer from <tt>registrar_link_header</tt> to <tt>referrals0</tt>.</li>
</ul>
</section>
</section>

</middle>

<back>
<references><name>References</name>
<references><name>Normative References</name>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7480.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7481.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9082.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9083.xml"/>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9110.xml"/>
</references>
<references><name>Informative References</name>
<xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9224.xml"/>
<reference anchor="gtld-rdap-profile" target="https://www.icann.org/gtld-rdap-profile">
  <front>
    <title>gTLD RDAP Profile</title>
    <author>
      <organization>ICANN</organization>
    </author>
    <date year="2024"></date>
  </front>
</reference>
</references>
</references>

</back>

</rfc>
