<?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-03" submissionType="IETF" category="std" xml:lang="en" xmlns:xi="http://www.w3.org/2001/XInclude" indexInclude="true" consensus="true">

<front>
<title abbrev="Explicit RDAP Redirects">Explicit RDAP Redirects</title><seriesInfo value="draft-ietf-regext-rdap-referrals-03" 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 redirected 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 redirect them to the URL of a related resource.</t>
</section>

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

<artwork><![CDATA[<base URL>redirects0_ref/<relation>/<lookup path>
]]></artwork>
<t>The client replaces <tt>&lt;base URL&gt;</tt> with the applicable base URL (which, as per
<xref target="RFC9224"></xref>, has a trailing <tt>/</tt> character), <tt>&lt;relation&gt;</tt> with the desired
relationship type, and <tt>&lt;lookup path&gt;</tt> with the lookup path of the object being
sought (which, as per <xref target="RFC9082"></xref>, does not have a leading <tt>/</tt> character).</t>
<t>For example, the URL of a redirect query for the domain <tt>example.com</tt>, where the
base URL for the &quot;<tt>com</tt>&quot; TLD is <tt>https://rdap.example.com/rdap/</tt>, would be:</t>

<artwork><![CDATA[https://rdap.example.com/rdap/redirects0_ref/related/domain/example.com
]]></artwork>
<t>The redirect query for the parent network of <tt>192.0.2.42</tt> with the base URL of
<tt>https://rdap.example.net/</tt> would be:</t>

<artwork><![CDATA[https://rdap.exampple.net/redirects0_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>Redirect 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-redirect-response"><name>RDAP Redirect 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), 307 (Temporary Redirect) or 308 (Permanent Redirect, see Section
15.4.9 of <xref target="RFC9110"></xref>); 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 redirect request from a domain registry to a domain registrar:</t>

<artwork><![CDATA[Client Request:

GET /redirects0_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 redirect request for a parent IPv4 network:</t>

<artwork><![CDATA[Client Request:

GET /redirects0_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 redirect request for a parent IPv6 network:</t>

<artwork><![CDATA[Client Request:

GET /redirects0_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 redirect 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 redirect 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-redirect-responses"><name>Client Processing of Redirect 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="rdapConformance"><name>RDAP Conformance</name>
<t>Servers which implement this specification <bcp14>MUST</bcp14> include the string
&quot;<tt>redirects0</tt>&quot; in the &quot;<tt>rdapConformance</tt>&quot; array in responses to RDAP &quot;help&quot;
queries.</t>
</section>

<section anchor="bootstrap"><name>Bootstrap Use Case</name>
<t>The primary use case of this extension is a one-hop redirect, where the client is not interested in the use
of this extension beyond the first redirect. Another use case is querying a bootstrap redirect server for
the authoritative source of information according to the IANA RDAP bootstrap information.</t>

<artwork><![CDATA[Client Request:

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

Server Response:

HTTP/1.1 307 Temporary Redirect
Location: https://rir1.example/ip/2001%3adb8%3a%3a/32
]]></artwork>
<t>Other uses cases may exist, but for this specific use case, this document registers the &quot;rdap-bootstrap&quot;
link relationship type.</t>
</section>

<section anchor="multi-hop-redirect-limitations"><name>Multi-Hop Redirect Limitations</name>
<t>In some scenarios, a target server might have a policy to issue another redirect using this extension.
For example:</t>

<artwork><![CDATA[Client Request to rir1.example:

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

Server Response:

HTTP/1.1 307 Temporary Redirect
Location: https://rir2.example/redirects0_ref/rdap-top/ip/2001%3adb8%3a%3a/32
]]></artwork>
<t>In this scenario rir1.example is redirecting to rir2.example with a &quot;/redirects0_ref&quot; path. However,
not all servers may support this extension. Therefore, the &quot;/redirects0_ref&quot; path defined in this
specification MUST only be used in an HTTP redirect if the server issuing the redirect is assured that the
target server of the redirect supports this extension.</t>
<t>Furthermore, servers SHOULD only use the &quot;/redirects0_ref&quot; path in an HTTP redirect when the link relationship
type is one for a terminal relationship such as &quot;rdap-top&quot; and &quot;rdap-bottom&quot; (i.e., &quot;rdap-up&quot; and &quot;rdap-down&quot;
do not explicitly express a relationship that is the end of a series of redirects).</t>
</section>

<section anchor="iana-considerations"><name>IANA Considerations</name>

<section anchor="rdap-extension-identifier"><name>RDAP Extension Identifier</name>
<t>IANA is requested to register the following value in the <xref target="rdap-extensions"></xref>
Registry:</t>
<t><strong>Extension identifier:</strong> <tt>redirects0</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 redirected to a
related resource for an RDAP resource.</t>
</section>

<section anchor="linkrelation"><name>Link Relations</name>
<t>IANA is requested to register the following value into the <xref target="link-relations"></xref> registry:</t>
<t><strong>Relation Name:</strong> rdap-bootstrap</t>
<t><strong>Description:</strong> Refers to an RDAP object for which a reference can be derived from RFC 9224.</t>
<t><strong>Reference:</strong> This document once published as an RFC.</t>
</section>
</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 redirect 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-02-to-03"><name>Changes from 02 to 03</name>

<ul>
<li><t>Consistely refer to &quot;redirect&quot; instead of &quot;referral&quot;. This includes changing
the extension identifier to <tt>redirects0</tt> and the document title.</t>
</li>
<li><t>Added <xref target="bootstrap"></xref> and <xref target="linkrelation"></xref>.</t>
</li>
<li><t>Correct specification of the redirect query path.</t>
</li>
<li><t>Updated <xref target="rdapConformance"></xref> to limit the use of the extension identifier to
help responses.</t>
</li>
<li><t>Include 308 in the list of redirection HTTP status codes.</t>
</li>
</ul>
<t>Thanks to Jasdip Singh for identifying the last three of these issues.</t>
</section>

<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>redirects0</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>
<reference anchor="link-relations" target="https://www.iana.org/assignments/link-relations/link-relations.xhtml">
  <front>
    <title>Link Relations</title>
    <author>
      <organization>IANA</organization>
    </author>
  </front>
</reference>
<reference anchor="rdap-extensions" target="https://www.iana.org/assignments/rdap-extensions/rdap-extensions.xhtml">
  <front>
    <title>RDAP Extensions</title>
    <author>
      <organization>IANA</organization>
    </author>
  </front>
</reference>
</references>
</references>

</back>

</rfc>
