RFC 4437

Web Distributed Authoring and Versioning (WebDAV) Redirect Reference Resources

๐Ÿ“… published March 2006, from ietf

Web Distributed Authoring and Versioning (WebDAV) Redirect Reference Resources ๐ŸŽ€

RFC 4437, from the Network Working Group, published March 2006. The authors are J. Whitehead (U.C. Santa Cruz), G. Clemm (IBM), and J. Reschke, Ed. (greenbytes). It's marked Category: Experimental, so it's an experiment, not a standard ๐Ÿงช. The title block has no Obsoletes or Updates line, so it doesn't replace or change any other RFC ๐Ÿ’….

Status of This Memo

okay so this memo defines an Experimental Protocol for the Internet community ๐Ÿงช. It is not an Internet standard of any kind. The authors want feedback and suggestions for improvement, and anyone can share this memo as widely as they like ๐Ÿซถ.

Copyright (C) The Internet Society (2006). ๐Ÿ“œ

Abstract

this spec is an extension to WebDAV that lets clients create redirect reference resources โœจ. These are resources whose default response is an HTTP/1.1 3xx (Redirection) status code ๐Ÿฆ‹. A redirect reference lets you reach the target resource indirectly, through any URI that's mapped to the redirect reference resource ๐Ÿช„.

Some things this doesn't cover: remapping whole trees of resources, and regular-expression based redirections ๐Ÿ™…โ€โ™€๏ธ. Redirect references come with no integrity guarantees either, so keep that in mind ๐Ÿ’€. Other mechanisms can get you the same result too. The whole point of this spec is to let operators experiment with it and figure out the best approach over time ๐Ÿ”ฌ.

Table of Contents

1. Introduction ....................................................3
2. Notational Conventions ..........................................4
3. Terminology .....................................................4
4. Overview of Redirect Reference Resources ........................5
5. Operations on Redirect Reference Resources ......................6
6. MKREDIRECTREF Method ............................................7

   6.1. Example: Creating a Redirect Reference Resource
        with MKREDIRECTREF .........................................8
7. UPDATEREDIRECTREF Method ........................................9
   7.1. Example: Updating a Redirect Reference Resource with
        UPDATEREDIRECTREF .........................................10
8. Operations on Collections That Contain Redirect
   Reference Resources ............................................11
   8.1. Example: PROPFIND on a Collection with Redirect
        Reference .................................................11
   8.2. Example: PROPFIND with Apply-To-Redirect-Ref on a
        Collection with Redirect Reference Resources ..............13
9. Operations on Targets of Redirect Reference Resources ..........15
10. Relative References in DAV:reftarget ..........................15
   10.1. Example: Resolving a Relative Reference in a
         Multi-Status Response.....................................16
11. Redirect References to Collections ............................17
12. Headers .......................................................18
   12.1. Redirect-Ref Response Header .............................18
   12.2. Apply-To-Redirect-Ref Request Header .....................19
13. Redirect Reference Resource Properties ........................19
   13.1. DAV:redirect-lifetime (protected) ........................19
   13.2. DAV:reftarget (protected) ................................19
14. XML Elements ..................................................19
   14.1. redirectref XML Element ..................................19
15. Extensions to the DAV:response XML Element for Multi-Status
    Responses .....................................................20
16. Capability Discovery ..........................................20
   16.1. Example: Discovery of Support for Redirect
         Reference Resources ......................................20
17. Security Considerations .......................................21
   17.1. Privacy Concerns .........................................21
   17.2. Redirect Loops ...........................................21
   17.3. Redirect Reference Resources and Denial of Service .......21
   17.4. Revealing Private Locations ..............................22
18. Internationalization Considerations ...........................22
19. IANA Considerations ...........................................22
   19.1. HTTP headers .............................................22
        19.1.1. Redirect-Ref ......................................22
        19.1.2. Apply-To-Redirect-Ref .............................23
20. Contributors ..................................................23
21. Acknowledgements ..............................................23
22. Normative References ..........................................23

1. Introduction โœจ

okay so this spec extends the Web Distributed Authoring Protocol (WebDAV) so clients can create new access paths to existing resources ๐Ÿ—๏ธ. This is useful for a few reasons, and they're honestly kind of iconic ๐Ÿ’–.

WebDAV lets you organise HTTP resources into hierarchies, grouped into things called collections ๐Ÿ“. Collections are way easier to browse and manage than one big flat pile. The catch is that a hierarchy forces every resource into exactly one spot, which is a real problem when something belongs in more than one category ๐Ÿ˜ฉ. Say you have a hierarchy of vehicle descriptions with collections for cars and boats. A description of a car/boat combo could go in either one ๐Ÿš—โ›ต. Ideally it would show up in both, and this spec makes that possible by letting clients create new URIs that point at the same resource ๐Ÿ™Œ.

Hierarchies also make sharing harder, because a resource that's useful in lots of collections still only gets one home ๐Ÿ . Take a maths department at one university that makes a collection about fractals ๐ŸŒ€. It links to some local resources, but it also needs access to resources hosted at other universities. Copying those resources is often a bad idea, for reasons like saving disk space, respecting copyright, or making sure any changes to the shared resource show up automatically ๐Ÿ™ˆ. So being able to create new access paths to existing resources, even in other collections or on completely unrelated systems, is really useful ๐ŸŒˆ.

Redirect reference resources are the mechanism this spec defines for making those alternative access paths ๐Ÿฆ‹. A redirect reference resource sits in one collection, and its whole job is to redirect requests to another resource, called its target, which might live in a different collection ๐ŸŽฏ. This means clients can send requests to the target from somewhere else. Most requests get redirected using a 3xx (Redirection) status code, so you get a kind of mediated access to the target ๐Ÿ”.

A redirect reference is a resource with properties but no body of its own ๐Ÿซง. Those properties can record things like who made the reference, when, and why ๐Ÿ“. Because redirect reference resources are built on HTTP 3xx responses, sending a request to the intended resource usually takes two round trips โณ. The good news is that redirect references work just as well for local resources and for resources on a different system from the reference ๐Ÿ’….

Here's the roadmap. Section 3 defines the terms used throughout the spec ๐Ÿ“–. Section 4 gives an overview of redirect reference resources ๐Ÿ”. Section 5 defines how existing methods behave when they're applied to redirect reference resources ๐Ÿ› ๏ธ. Section 6 covers creating a redirect reference resource, and Section 7 covers updating one ๐Ÿ”„. Section 8 covers what happens when collections contain redirect reference resources ๐Ÿ“‚. Sections 9 through 11 talk about other issues that come up because redirect reference resources exist ๐Ÿงฉ. Sections 12 through 15 define the new headers, properties, and XML elements required to support redirect reference resources ๐Ÿ“ฆ. Section 16 covers capability discovery ๐Ÿ”Ž. Sections 17 through 19 cover the security, internationalization, and IANA concerns ๐Ÿ”. The rest of the sections are supporting information ๐Ÿ“š.

2. Notational Conventions ๐Ÿ“

this document describes a set of extensions to the WebDAV Distributed Authoring Protocol [RFC2518], which is itself an extension to HTTP/1.1 ๐Ÿง . So the augmented BNF used here to describe protocol elements is exactly the same as the one in Section 2.1 of [RFC2616] ๐Ÿค“. That augmented BNF uses the basic production rules from Section 2.2 of [RFC2616], and those rules apply to this document too โœ….

In this document, the key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" are to be interpreted as described in [RFC2119] ๐Ÿ”‘. These are the official requirement-level words, so when you see them they carry real weight ๐Ÿ’ช.

3. Terminology ๐Ÿ“–

the terminology here follows and extends the terms in the WebDAV Distributed Authoring Protocol specification [RFC2518] โœจ. The definitions of resource, Uniform Resource Identifier (URI), and Uniform Resource Locator (URL) come from [RFC3986] ๐Ÿ”—.

Redirect Reference Resource ๐Ÿฆ‹ A resource created to redirect all requests made to it, using an HTTP status code from the 3xx range, to a defined target resource.

Non-Reference Resource ๐Ÿงฑ A resource that is not a reference to another resource.

Target Resource ๐ŸŽฏ The resource to which requests are redirected by a redirect reference resource. A target resource can be anything that can be identified by an absolute URI (see [RFC3986], "absolute-URI").

This document uses the terms "precondition", "postcondition", and "protected property" as defined in [RFC3253] ๐Ÿงพ. Servers MUST report pre-/postcondition failures as described in Section 1.6 of this document. This one is a must, not a maybe, so don't skip it ๐Ÿšจ.

4. Overview of Redirect Reference Resources โœจ

okay so, bestie, for ANY operation you submit to a redirect reference resource, the default response is a 302 (Found) ๐Ÿ’…. It comes with the Redirect-Ref header (more on that in Section 12.1, below) and a Location header ([RFC2616], Section 14.30) set to the URI of the target resource ๐ŸŽ€. So the client can just resubmit the request to that target URI. Easy peasy ๐ŸŒธ

A redirect reference resource never automatically forwards requests to its target resource ๐Ÿ™…โ€โ™€๏ธ. Redirect resources give you the same vibe as links in HTML documents ๐Ÿ”—. They can be created and maintained without the involvement or even knowledge of their target resource, and that makes linking between resources way cheaper ๐Ÿ’–.

If the client knows it's working with a redirect reference resource, it can resolve the reference by retrieving the reference resource's DAV:reftarget property (defined in Section 13.2, below). Its value contains the URI of the target resource โœจ. Then the client can submit requests to the target resource ๐Ÿฆ‹.

A redirect reference resource is a brand new type of resource ๐ŸŒˆ. To tell redirect reference resources apart from non-reference resources, a new value of the DAV:resourcetype property (defined in [RFC2518]), DAV:redirectref, is defined in Section 14.1, below ๐Ÿงš.

Since a redirect reference resource is a resource, methods can be applied to the reference resource as well as to its target resource ๐Ÿ’œ.

The Apply-To-Redirect-Ref request header (defined in Section 12.2, below) exists so that referencing-aware clients can control whether an operation hits the redirect reference resource itself, or whether standard HTTP/WebDAV behaviour (redirection with a 3xx status code) happens instead ๐Ÿ‘‘. You can use Apply-To-Redirect-Ref with most requests to redirect reference resources. It's especially useful with PROPFIND when you want the reference resource's own properties ๐Ÿ”ฅ.

Implementation Note: Operations on the target of a redirect reference usually do not affect the redirect reference itself ๐Ÿ™ˆ. Still, clients should not rely on this behaviour, because (for instance) some servers may update redirect references as a result of namespace operations on the reference's target ๐Ÿ’€.


5. Operations on Redirect Reference Resources

Okay, so non-referencing-aware clients can't create reference resources, but they should still be able to submit requests through the reference resources made by reference-aware WebDAV clients ๐Ÿซถ. They should be able to follow any references to their targets ๐Ÿฆ‹. To make that possible, a server that receives any request made via a redirect reference resource MUST return a 3xx range (Redirection) status code, unless the request includes an Apply-To-Redirect-Ref header specifying "T" ๐Ÿ’…. The client and server MUST follow [RFC2616], Section 10.3, but with these extra rules:

  • The Location response header MUST contain a URI (see [RFC3986], Section 3) that identifies the target of the reference resource ๐ŸŽ€.
  • The response MUST include the Redirect-Ref header โœจ. This header lets reference-aware WebDAV clients recognize the resource as a reference resource and understand why they got redirected ๐Ÿง .

A reference-aware WebDAV client can, just like a non-referencing client, resubmit the request to the URI in the Location header to operate on the target resource ๐ŸŒธ. Or it can resubmit the request to the URI of the redirect reference resource with the Apply-To-Redirect-Ref: T header to operate on the reference resource itself ๐Ÿ“. In that case the request MUST be applied to the reference resource itself, and a 3xx response MUST NOT be returned ๐Ÿ™Œ.

As redirect references do not have bodies, GET and PUT requests with Apply-To-Redirect-Ref: T MUST fail with status 403 (forbidden) ๐Ÿšซ. Not possible, bestie ๐Ÿ˜ญ.


6. MKREDIRECTREF Method

The MKREDIRECTREF method requests the creation of a redirect reference resource ๐Ÿงš.

If a MKREDIRECTREF request fails, the server state preceding the request MUST be restored ๐Ÿ”„.

Responses from a MKREDIRECTREF request MUST NOT be cached ๐Ÿ™…โ€โ™€๏ธ, because MKREDIRECTREF has non-idempotent and non-safe semantics (see [RFC2616], Section 9.1). Not cute to cache this one ๐Ÿ’€.

Marshalling

The request body MUST be a DAV:mkredirectref XML element ๐ŸŽ€.

<!ELEMENT mkredirectref (reftarget, redirect-lifetime?)>
<!ELEMENT reftarget (href)>
<!ELEMENT redirect-lifetime (permanent | temporary)>
<!ELEMENT permanent EMPTY>
<!ELEMENT temporary EMPTY>

The DAV:href element is defined in [RFC2518] (Section 12.3) and MUST contain either a URI or a relative-ref (see [RFC3986], Sections 3 and 4.2) ๐Ÿ”—.

If no DAV:redirect-lifetime element is specified, the server MUST behave as if a value of DAV:temporary was specified โณ.

If the request succeeds, the server MUST return 201 (Created) status ๐ŸŽ‰.

If a response body for a successful request is included, it MUST be a DAV:mkredirectref-response XML element. This document doesn't define any elements for the MKREDIRECTREF response body, but DAV:mkredirectref-response is defined so future extensions that do define response body elements stay interoperable ๐Ÿซถ.

<!ELEMENT mkredirectref-response ANY>

Preconditions

  • (DAV:resource-must-be-null): A resource MUST NOT exist at the Request-URI ๐Ÿ™ˆ.
  • (DAV:parent-resource-must-be-non-null): The Request-URI minus the last path segment MUST identify a collection ๐Ÿ“.
  • (DAV:name-allowed): The last segment of the Request-URI is available for use as a resource name ๐Ÿท๏ธ.
  • (DAV:locked-update-allowed): If the collection identified by the Request-URI minus the last path segment is write-locked, then the appropriate token MUST be specified in an If request header ๐Ÿ”.
  • (DAV:redirect-lifetime-supported): If the request body contains a DAV:redirect-lifetime element, the server MUST support the specified lifetime. Support for DAV:temporary is REQUIRED, while support for DAV:permanent is OPTIONAL ๐Ÿฐ.
  • (DAV:legal-reftarget): The specified is a legal URI or relative-ref โœ….

Postconditions

  • (DAV:new-redirectref): a new redirect reference resource is created whose DAV:reftarget property has the value specified in the request body ๐Ÿฆ‹.

6.1. Example: Creating a Redirect Reference Resource with MKREDIRECTREF

>> Request:

MKREDIRECTREF /~whitehead/dav/spec08.ref HTTP/1.1
Host: www.example.com
Content-Type: text/xml; charset="utf-8"
Content-Length: xxx

<?xml version="1.0" encoding="utf-8" ?>
<D:mkredirectref xmlns:D="DAV:">
  <D:reftarget>
    <D:href>/i-d/draft-webdav-protocol-08.txt</D:href>
  </D:reftarget>
</D:mkredirectref>

>> Response:

HTTP/1.1 201 Created

This request resulted in the creation of a new redirect reference resource at http://www.example.com/~whitehead/dav/spec08.ref ๐ŸŒŸ. It points to the resource identified by the DAV:reftarget property. In this example, the target resource is identified by the URI http://www.example.com/i-d/draft-webdav-protocol-08.txt ๐ŸŽฏ. The redirect reference resource's DAV:resourcetype property is set to DAV:redirectref, and its DAV:redirect-lifetime property has the value DAV:temporary ๐Ÿ’–.


7. UPDATEREDIRECTREF Method

The UPDATEREDIRECTREF method requests the update of a redirect reference resource โœ๏ธ.

If an UPDATEREDIRECTREF request fails, the server state preceding the request MUST be restored ๐Ÿ”„.

Responses from an UPDATEREDIRECTREF request MUST NOT be cached ๐Ÿ™…โ€โ™€๏ธ, because UPDATEREDIRECTREF has non-safe semantics (see [RFC2616], Section 9.1).

Marshalling

The request body MUST be a DAV:updateredirectref XML element ๐ŸŽ€.

<!ELEMENT updateredirectref (reftarget?, redirect-lifetime?)>

See Section 6 for a definition of DAV:reftarget and DAV:redirect-lifetime ๐Ÿ”.

If no DAV:reftarget element is specified, the server MUST NOT change the target of the redirect reference ๐Ÿšซ.

If no DAV:redirect-lifetime element is specified, the server MUST NOT change the lifetime of the redirect reference โณ.

If a response body for a successful request is included, it MUST be a DAV:updateredirectref-response XML element. This document doesn't define any elements for the UPDATEREDIRECTREF response body either, but DAV:updateredirectref-response is defined to keep future extensions interoperable ๐Ÿซถ.

<!ELEMENT updateredirectref-response ANY>

Preconditions

  • (DAV:locked-update-allowed): if the resource is write-locked, then the appropriate token MUST be specified in an If request header ๐Ÿ”.
  • (DAV:must-be-redirectref): the resource identified by the Request-URI must be a redirect reference resource as defined by this specification ๐Ÿฆ‹.
  • (DAV:redirect-lifetime-supported): see Section 6 ๐Ÿฐ.
  • (DAV:redirect-lifetime-update-supported): servers MAY support changing the DAV:redirect-lifetime property; if they don't, this condition code can be used to signal failure ๐Ÿšฆ.
  • (DAV:legal-reftarget): see Section 6 โœ….

Postconditions

  • (DAV:redirectref-updated): the DAV:reftarget and DAV:redirect-lifetime properties of the redirect reference have been updated accordingly โœจ.

7.1. Example: Updating a Redirect Reference Resource with UPDATEREDIRECTREF

>> Request:

UPDATEREDIRECTREF /~whitehead/dav/spec08.ref HTTP/1.1
Host: www.example.com
Apply-To-Redirect-Ref: T
Content-Type: text/xml; charset="utf-8"
Content-Length: xxx

<?xml version="1.0" encoding="utf-8" ?>
<D:updateredirectref xmlns:D="DAV:">
  <D:reftarget>
    <D:href>/i-d/draft-webdav-protocol-08b.txt</D:href>
  </D:reftarget>
</D:updateredirectref>

>> Response:

HTTP/1.1 200 OK

This request updated the redirect reference's DAV:reftarget property to "/i-d/draft-webdav-protocol-08b.txt" ๐ŸŽ€ and didn't change the DAV:redirect-lifetime value ๐ŸŒธ. Note that the "Apply-To-Redirect-Ref" request header must be used ๐Ÿ“Œ. Otherwise, the request would result in a redirect (3xx) response status ๐Ÿ˜ญ.

8. Operations on Collections That Contain Redirect Reference Resources โœจ

okay so, according to [RFC2518], Section 9.2, methods that have defined interactions with the "Depth" request header should apply all other request headers to each resource in scope ๐Ÿ’…. But if we applied that rule to "Apply-To-Redirect-Ref" across the board, it would be super impractical to build this spec on top of existing servers ๐Ÿ˜ญ. It would also cause unexpected server behaviour for clients that don't even know redirect references exist ๐Ÿ™ˆ. The good news is that the "Depth" header lets alternate behaviours be explicitly defined, so we don't have to force it ๐Ÿซถ.

So this spec defines the interaction between "Depth" and "Apply-To-Redirect-Ref" on a case-by-case basis ๐ŸŽ€. It also provides a default for methods that aren't mentioned here and don't define their own behaviour โœจ.

+-------------+-----------------+------------------+-----------+
| method name | defined in      | supported depths | behaviour |
+-------------+-----------------+------------------+-----------+
| COPY        | [RFC2518], 8.9  | 0, infinity      | "T"       |
| DELETE      | [RFC2518], 8.7  | infinity         | "T"       |
| LOCK        | [RFC2518], 8.11 | 0, infinity      | "T"       |
| MOVE        | [RFC2518], 8.10 | 0, infinity      | "T"       |
| PROPFIND    | [RFC2518], 8.2  | 0, 1, infinity   | inherit   |
| REPORT      | [RFC3253], 3.6  | 0, 1, infinity   | inherit   |
| default     |                 |                  | "T"       |
+-------------+-----------------+------------------+-----------+

When the behaviour is defined to be "inherit", the method should follow [RFC2518]'s default behaviour for "Depth" operations ๐ŸŒธ. That means applying the value given for "Apply-To-Redirect-Ref" to each resource in scope. When the behaviour is defined to be "T" instead, the method should behave as if an "Apply-To-Redirect-Ref: T" header was specified for each operation on child resources ๐Ÿฆ‹. This is the bit that keeps "Depth: infinity" operations from failing unexpectedly just because a redirect reference resource happened to be in scope ๐Ÿ’–.

8.1. Example: PROPFIND on a Collection with Redirect Reference Resources

Suppose a PROPFIND request with Depth: infinity is submitted to the following collection, with the members shown here ๐Ÿ“:

/MyCollection/
     (non-reference resource) diary.html
     (redirect reference resource) nunavut
Request:
PROPFIND /MyCollection/ HTTP/1.1
Host: example.com
Depth: infinity
Apply-To-Redirect-Ref: F
Content-Type: text/xml
Content-Length: xxxx

<?xml version="1.0" ?>
<D:propfind xmlns:D="DAV: ">
  <D:prop xmlns:J="http://example.com/jsprops/">
    <D:resourcetype/>
    <J:keywords/>
  </D:prop>
</D:propfind>
Response:
HTTP/1.1 207 Multi-Status
Content-Type: text/xml
Content-Length: xxxx

<?xml version="1.0" ?>
<D:multistatus xmlns:D="DAV:" xmlns:J="http://example.com/jsprops/">
  <D:response>
    <D:href>/MyCollection/</D:href>
    <D:propstat>
      <D:prop>
        <D:resourcetype><D:collection/></D:resourcetype>
        <J:keywords>diary, interests, hobbies</J:keywords>
      </D:prop>
      <D:status>HTTP/1.1 200 OK</D:status>
    </D:propstat>
  </D:response>
  <D:response>
    <D:href>/MyCollection/diary.html</D:href>
    <D:propstat>
      <D:prop>
        <D:resourcetype/>
        <J:keywords>diary, travel, family, history</J:keywords>
      </D:prop>
      <D:status>HTTP/1.1 200 OK</D:status>
    </D:propstat>

  </D:response>
  <D:response>
    <D:href>/MyCollection/nunavut</D:href>
    <D:status>HTTP/1.1 302 Found</D:status>
    <D:location>
      <D:href>http://example.ca/art/inuit/</D:href>
    </D:location>
  </D:response>
</D:multistatus>

In this example, the Depth header is set to infinity and the Apply-To-Redirect-Ref header is set to "F" โœจ. The collection contains one URI that identifies a redirect reference resource. The response element for that redirect reference resource has a status of 302 (Found) and includes a DAV:location extension element, so clients can retrieve the properties of its target resource ๐Ÿงš. (The response element for the redirect reference resource doesn't include the requested properties. The client can submit another PROPFIND request to the URI in the DAV:location pseudo-property to get those properties ๐Ÿ’….)

8.2. Example: PROPFIND with Apply-To-Redirect-Ref on a Collection with Redirect Reference Resources

Suppose a PROPFIND request with "Apply-To-Redirect-Ref: T" and Depth: infinity is submitted to the following collection, with the members shown here ๐ŸŒˆ:

/MyCollection/
     (non-reference resource) diary.html
     (redirect reference resource) nunavut
Request:
PROPFIND /MyCollection/ HTTP/1.1
Host: example.com
Depth: infinity
Apply-To-Redirect-Ref: T
Content-Type: text/xml
Content-Length: xxxx
<?xml version="1.0" ?>
<D:propfind xmlns:D="DAV:">
  <D:prop>
    <D:resourcetype/>
    <D:reftarget/>
    <D:redirect-lifetime/>
  </D:prop>
</D:propfind>
Response:
HTTP/1.1 207 Multi-Status
Content-Type: text/xml
Content-Length: xxxx

<?xml version="1.0" ?>
<D:multistatus xmlns:D="DAV:">
  <D:response>
    <D:href>/MyCollection/</D:href>
    <D:propstat>
      <D:prop>
        <D:resourcetype><D:collection/></D:resourcetype>
      </D:prop>
      <D:status>HTTP/1.1 200 OK</D:status>
    </D:propstat>
    <D:propstat>
      <D:prop>
        <D:reftarget/>
        <D:redirect-lifetime/>
      </D:prop>
      <D:status>HTTP/1.1 404 Not Found</D:status>
    </D:propstat>
  </D:response>
  <D:response>
    <D:href>/MyCollection/diary.html</D:href>
    <D:propstat>
      <D:prop>
        <D:resourcetype/>
      </D:prop>
      <D:status>HTTP/1.1 200 OK</D:status>
    </D:propstat>
    <D:propstat>
      <D:prop>
        <D:reftarget/>
        <D:redirect-lifetime/>
      </D:prop>
      <D:status>HTTP/1.1 404 Not Found</D:status>
    </D:propstat>

  </D:response>
  <D:response>
    <D:href>/MyCollection/nunavut</D:href>
    <D:propstat>
      <D:prop>
        <D:resourcetype><D:redirectref/></D:resourcetype>
        <D:reftarget>
          <D:href>http://example.ca/art/inuit/</D:href>
        </D:reftarget>
        <D:redirect-lifetime><D:temporary/></D:redirect-lifetime>
      </D:prop>
    <D:status>HTTP/1.1 200 OK</D:status>
    </D:propstat>
  </D:response>
</D:multistatus>

Since the "Apply-To-Redirect-Ref: T" header is present, the response shows the properties of the redirect reference resource in the collection rather than reporting a 302 status ๐ŸŽ‰.


9. Operations on Targets of Redirect Reference Resources

Operations on targets of redirect reference resources have no effect on the reference resource ๐Ÿซถ. Bestie, the reference resource is totally independent of what happens to its target ๐Ÿ’….

10. Relative References in DAV:reftarget

The URI in the href in a DAV:reftarget property MAY be a relative reference ๐Ÿฆ‹. In that case, the base URI used to resolve it to absolute form is the URI used in the HTTP message to identify the redirect reference resource that the DAV:reftarget property belongs to ๐Ÿงš.

When DAV:reftarget appears in the context of a Multi-Status response, it's inside a DAV:response element that contains a single DAV:href element ๐ŸŒธ. The value of that DAV:href element serves as the base URI for resolving a relative reference in DAV:reftarget. The value of DAV:href may itself be relative, in which case it must be resolved first, so it can serve as the base URI for the relative reference in DAV:reftarget ๐Ÿ”ฅ. If the DAV:href element is relative, its base URI is constructed from the scheme component "http", the value of the Host header in the request, and the Request-URI ๐Ÿ’œ.

10.1. Example: Resolving a Relative Reference in a Multi-Status Response

Request:
PROPFIND /geog/ HTTP/1.1
Host: example.com
Apply-To-Redirect-Ref: T
Depth: 1
Content-Type: text/xml
Content-Length: nnn

<?xml version="1.0" ?>
<D:propfind xmlns:D="DAV:">
  <D:prop>
    <D:resourcetype/>
    <D:reftarget/>
  </D:prop>
</D:propfind>
Response:
HTTP/1.1 207 Multi-Status
Content-Type: text/xml
Content-Length: nnn

<?xml version="1/0" ?>
<D:multistatus xmlns:D="DAV:">
  <D:response>
    <D:href>/geog/</D:href>
    <D:propstat>
      <D:prop>
        <D:resourcetype><D:collection/></D:resourcetype>
      </D:prop>
      <D:status>HTTP/1.1 200 OK</D:status>
    </D:propstat>
    <D:propstat>
      <D:prop><D:reftarget/></D:prop>
      <D:status>HTTP/1.1 404 Not Found</D:status>
    </D:propstat>
  </D:response>
  <D:response>
    <D:href>/geog/stats.html</D:href>
    <D:propstat>
      <D:prop>
        <D:resourcetype><D:redirectref/></D:resourcetype>
        <D:reftarget>
          <D:href>statistics/population/1997.html</D:href>

        </D:reftarget>
      </D:prop>
    <D:status>HTTP/1.1 200 OK</D:status>
    </D:propstat>
  </D:response>
</D:multistatus>

In this example, the relative reference "statistics/population/1997.html" is returned as the value of the DAV:reftarget property for the reference resource identified by href /geog/stats.html ๐ŸŒˆ. That href is itself a relative reference, which resolves to http://example.com/geog/stats.html. This is the base URI for resolving the relative reference in reftarget. So the absolute URI of reftarget is http://example.com/geog/statistics/population/1997.html ๐Ÿ’–.

11. Redirect References to Collections โœจ

okay so this section is where redirect reference resources get really wild ๐Ÿ˜ญ๐ŸŒ€. In a Request-URI /segment1/segment2/segment3, any of the three segments can be a redirect reference resource ๐Ÿฆ‹. (Check [RFC3986], Section 3.3, if you want the official definitions of "path" and "segment" ๐Ÿค“.) If any segment in a Request-URI turns out to be a redirect reference resource, the response SHOULD be a 3xx ๐Ÿ’…. The Location header in that response gets worked out like this:

The leftmost path segment of the Request-URI that is a redirect reference resource, plus every path segment and separator to its left, gets swapped out for the redirect reference resource's DAV:reftarget property (resolved to an absolute URI) ๐ŸŽ€. Whatever is left over in the Request-URI just gets stuck onto the end of that new path ๐Ÿงš.

Note: If the DAV:reftarget property ends with a / and the remainder of the Request-URI is non-empty (so it has to start with a /), the final / in the DAV:reftarget property gets dropped before the remainder is appended ๐Ÿ’–.

Okay, let's do an example, because this is where it clicks ๐ŸŒธ. Say the Request-URI is /x/y/z.html. Suppose /x/ is a redirect reference resource whose target is the collection /a/. That collection holds a redirect reference resource called y, whose target is the collection /b/. And that collection holds a redirect reference resource called z.html, whose target is /c/d.html ๐ŸŒˆ.

                    /x/y/z.html
                        |
                        | /x -> /a
                        |
                        v
                    /a/y/z.html
                        |
                        | /a/y -> /b
                        |
                        v
                    /b/z.html
                        |
                        | /b/z.html -> /c/d.html
                        |
                        v
                    /c/d.html

So the client has to follow up three separate 3xx responses before it finally lands on the target resource ๐Ÿ˜ฉ๐Ÿ›ค๏ธ. The server answers the first request with a 3xx and Location: /a/y/z.html, and the client resubmits the request to /a/y/z.html. The server answers that one with a 3xx and Location: /b/z.html, and the client resubmits to /b/z.html. The server answers this one with a 3xx and Location: /c/d.html, and the client resubmits to /c/d.html. Finally, that last request succeeds ๐ŸŽ‰๐Ÿ‘‘.

Note: The behaviour described above may have a very serious impact on the efficiency of mapping Request-URIs to resources in HTTP request processing. Therefore, servers MAY respond with a 404 status code if the cost of checking all leading path segments for redirect references seems prohibitive ๐Ÿ’€. (Honestly, that's a very fair escape hatch, bestie ๐Ÿ™ˆ.)

12. Headers ๐ŸŽ€

12.1. Redirect-Ref Response Header

Redirect-Ref = "Redirect-Ref:" (URI | relative-ref)
; URI: see [RFC3986], Section 3
; relative-ref: see [RFC3986], Section 4.2

The Redirect-Ref header shows up in all 3xx responses from redirect reference resources ๐Ÿ’Œ. Its value is the link target you specified when you created the redirect reference resource ๐Ÿ”—.

12.2. Apply-To-Redirect-Ref Request Header

Apply-To-Redirect-Ref = "Apply-To-Redirect-Ref" ":" ("T" | "F")

The optional Apply-To-Redirect-Ref header can be used on any request to a redirect reference resource ๐Ÿง. When it's present and set to "T", the request MUST be applied to the reference resource itself, and a 3xx response MUST NOT be returned ๐Ÿ™…โ€โ™€๏ธ. No redirect, no drama, just vibes ๐Ÿ’œ.

If the Apply-To-Redirect-Ref header gets used on a request to any other sort of resource besides a redirect reference resource, the server MUST ignore it ๐Ÿซถ.

13. Redirect Reference Resource Properties ๐ŸŒธ

The properties defined below are REQUIRED on redirect reference resources ๐Ÿ“‹. A PROPFIND/allprop request SHOULD NOT return any of the properties defined in this document ๐Ÿ™ˆ, because nobody needs that much info dumped on them at once.

13.1. DAV:redirect-lifetime (protected)

This property tells you about the lifetime of a redirect โณ. It can be either DAV:permanent (HTTP status 301) or DAV:temporary (HTTP status 302) ๐Ÿฆ‹. Future protocols may define additional values ๐Ÿ”ฎ.

<!ELEMENT redirect-lifetime (permanent | temporary)>
<!ELEMENT permanent EMPTY>
<!ELEMENT temporary EMPTY>

13.2. DAV:reftarget (protected)

This property gives clients an efficient way to discover the URI of the target resource ๐Ÿงญ. It's read-only after its initial creation, and its value can only be set in a MKREDIRECTREF request ๐Ÿ”’. The value is a DAV:href element containing the URI of the target resource ๐Ÿ’–.

<!ELEMENT reftarget href >

14. XML Elements ๐Ÿงš

14.1. redirectref XML Element

Name: redirectref

Namespace: DAV:

Purpose: Used as the value of the DAV:resourcetype property to specify that the resource type is a redirect reference resource ๐ŸŽ€.

<!ELEMENT redirectref EMPTY >

15. Extensions to the DAV:response XML Element for Multi-Status Responses โœจ

As described in Section 8, the DAV:location element may be returned in the DAV:response element of a 207 Multi-Status response ๐Ÿ“ฌ. That lets clients resubmit their requests to the target resource of a redirect reference resource ๐Ÿƒโ€โ™€๏ธ.

Because of that, the definition of the DAV:response XML element changes to the following ๐Ÿ”„:

<!ELEMENT response (href, ((href*, status)|(propstat+)),
                    responsedescription?, location?) >
<!ELEMENT location (href) >

16. Capability Discovery ๐Ÿ‘‘

Sections 9.1 and 15 of [RFC2518] describe how compliance classes get used with the DAV header in responses to OPTIONS, so a server can say which parts of the WebDAV Distributed Authoring protocols a resource supports ๐Ÿ—‚๏ธ. This specification defines an OPTIONAL extension to [RFC2518] ๐Ÿ’…. It adds a new compliance class called redirectrefs, for use with the DAV header in responses to OPTIONS requests ๐ŸŒˆ. If a resource does support redirect references, its OPTIONS response can show that by listing the new redirectrefs compliance class in the DAV header and by listing the MKREDIRECTREF method as one it supports ๐Ÿซถ.

When it's responding to an OPTIONS request, any type of resource can include redirectrefs in the value of the DAV header ๐Ÿฆ‹. Doing that tells everyone that the server permits a redirect reference resource at the Request-URI โœจ.

16.1. Example: Discovery of Support for Redirect Reference Resources

>> Request:

OPTIONS /somecollection/someresource HTTP/1.1
Host: example.org

>> Response:

HTTP/1.1 200 OK
Allow: OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, COPY, MOVE
Allow: MKCOL, PROPFIND, PROPPATCH, LOCK, UNLOCK, MKREDIRECTREF
DAV: 1, 2, redirectrefs

The DAV header in the response shows that the resource /somecollection/someresource is level 1 and level 2 compliant, as defined in [RFC2518] ๐Ÿ“š. On top of that, /somecollection/someresource supports redirect reference resources ๐ŸŽ‰. The Allow header shows that MKREDIRECTREF requests can be submitted to /somecollection/someresource ๐Ÿ’œ.

17. Security Considerations ๐Ÿ’€๐Ÿ”

This section is here to make applications that implement this protocol aware of its security implications ๐Ÿšจ. Bestie, please read this part carefully ๐Ÿซถ.

All of the security considerations of HTTP/1.1 and the WebDAV Distributed Authoring Protocol specification also apply to this protocol specification ๐Ÿงฑ. On top of that, redirect reference resources bring several new security concerns and raise the risk of some existing threats ๐Ÿ˜ฑ. Those issues are detailed below ๐Ÿ‘‡.

17.1. Privacy Concerns

By creating redirect reference resources on a trusted server, it's possible for a hostile agent to trick users into sending private information to a target on an unrelated system ๐Ÿ˜ค. This risk is mitigated somewhat, since clients are required to notify the user of the redirection for any request other than GET or HEAD ๐Ÿ›ก๏ธ. (See [RFC2616], Section 10.3.3, 302 Found.)

17.2. Redirect Loops

Redirect loops were already possible in HTTP 1.1, but the introduction of the MKREDIRECTREF method creates a new avenue for clients to create loops, whether by accident or on purpose ๐ŸŒ€. If the reference resource and its target are on the same server, the server may be able to detect MKREDIRECTREF requests that would create loops ๐Ÿ•ต๏ธโ€โ™€๏ธ. See also [RFC2616], Section 10.3, "Redirection 3xx." ๐Ÿ“–

17.3. Redirect Reference Resources and Denial of Service

Denial of service attacks were already possible by posting URLs that were meant for limited use at heavily used Web sites ๐ŸŒŠ. The introduction of MKREDIRECTREF creates a new avenue for similar denial of service attacks โš ๏ธ. Clients can now create redirect reference resources at heavily used sites that point to locations which were never designed for heavy traffic ๐Ÿ˜ญ.

17.4. Revealing Private Locations

There are several ways that redirect reference resources can reveal information about collection structures ๐Ÿ”. First, the DAV:reftarget property of every redirect reference resource contains the URI of the target resource ๐Ÿ—บ๏ธ. Anyone who has access to the reference resource can discover the collection path that leads to the target resource ๐Ÿ‘€. The owner of the target resource may have wanted to keep this collection structure under wraps ๐Ÿ™Š.

Sufficiently powerful access control mechanisms can control this risk to some extent ๐Ÿ”. Property-level access control could stop users from examining the DAV:reftarget property ๐Ÿšซ. (The Location header returned in responses to requests on redirect reference resources reveals the same information, however ๐Ÿฅฒ.)

This risk is no greater than the similar risk posed by HTML links ๐Ÿ”—.

18. Internationalization Considerations ๐ŸŒ

All internationalization considerations mentioned in [RFC2518] also apply to this document ๐Ÿ—ฃ๏ธ.

19. IANA Considerations ๐Ÿ“

All IANA considerations mentioned in [RFC2518] also apply to this document ๐Ÿ“.

19.1. HTTP headers

This document specifies the two new HTTP headers listed below ๐ŸŽ€.

19.1.1. Redirect-Ref

  • Header field name: Redirect-Ref
  • Applicable protocol: http
  • Status: standard
  • Author/Change controller: IETF
  • Specification document: this specification (Section 12.1)

19.1.2 Apply-To-Redirect-Ref

  • Header field name: Apply-To-Redirect-Ref
  • Applicable protocol: http
  • Status: standard
  • Author/Change controller: IETF
  • Specification document: this specification (Section 12.2)

20. Contributors ๐Ÿซถ

Many thanks to Jason Crawford, Jim Davis, Chuck Fay, and Judith Slein ๐Ÿ’–, who can take credit for big parts of the original design of this specification ๐Ÿ‘‘.

21. Acknowledgements ๐ŸŒŸ

This document has benefited from thoughtful discussion by Jim Amsden, Peter Carlson, Steve Carter, Tyson Chihaya, Ken Coar, Ellis Cohen, Bruce Cragun, Spencer Dawkins, Mark Day, Rajiv Dulepet, David Durand, Lisa Dusseault, Stefan Eissing, Roy Fielding, Yaron Goland, Fred Hitt, Alex Hopmann, James Hunt, Marcus Jager, Chris Kaler, Manoj Kasichainula, Rohit Khare, Daniel LaLiberte, Steve Martin, Larry Masinter, Jeff McAffer, Joe Orton, Surendra Koduru Reddy, Juergen Reuter, Max Rible, Sam Ruby, Bradley Sergeant, Nick Shelness, John Stracke, John Tigue, John Turner, Kevin Wiggen, and others ๐Ÿฅฐ๐ŸŒˆ.

22. Normative References โœจ

okay so these are the docs this spec literally can't function without, bestie ๐Ÿ“š each one is a link you have to read to understand the whole thing ๐Ÿซถ

  • [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
  • [RFC2518] Goland, Y., Whitehead, E., Faizi, A., Carter, S., and D. Jensen, "HTTP Extensions for Distributed Authoring -- WEBDAV", RFC 2518, February 1999.
  • [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999.
  • [RFC3253] Clemm, G., Amsden, J., Ellison, T., Kaler, C., and J. Whitehead, "Versioning Extensions to WebDAV (Web Distributed Authoring and Versioning)", RFC 3253, March 2002.
  • [RFC3986] Berners-Lee, T., Fielding, R., and L. Masinter, "Uniform Resource Identifier (URI): Generic Syntax", STD 66, RFC 3986, January 2005.

Authors' Addresses ๐ŸŽ€

these are the people who wrote it, so you know exactly who to thank (or blame ๐Ÿ˜ญ)

Jim Whitehead
UC Santa Cruz, Dept. of Computer Science
1156 High Street
Santa Cruz, CA  95064
US

EMail: ejw@cse.ucsc.edu
Geoff Clemm
IBM
20 Maguire Road
Lexington, MA  02421
US

EMail: geoffrey.clemm@us.ibm.com
Julian F. Reschke (editor)
greenbytes GmbH
Hafenweg 16
Muenster, NW  48155
Germany

Phone: +49 251 2807760
Fax:   +49 251 2807761
EMail: julian.reschke@greenbytes.de
URI:   http://greenbytes.de/tech/webdav/

okay the legal bit, but make it quick ๐Ÿ’… The Internet Society owns the copyright here (2006). This document is covered by the rights, licenses and restrictions in BCP 78, and unless that says otherwise, the authors keep all their rights.

The document and everything in it is provided "AS IS". The contributor, the organization they represent or are sponsored by (if any), the Internet Society, and the Internet Engineering Task Force all disclaim every warranty, express or implied. That includes no warranty that using the information won't infringe any rights, and no implied warranties of merchantability or fitness for a particular purpose. So use it with eyes open, periodt ๐Ÿ™ˆ


Intellectual Property ๐Ÿฆ‹

the IETF doesn't take a side on whether any IPR (intellectual property rights) apply to the tech in here, or whether you can get a license to use it. It also hasn't checked for any rights on its own. If you want the details on how rights work for RFC docs, look at BCP 78 and BCP 79 ๐Ÿ”ฅ

Copies of IPR disclosures sent to the IETF Secretariat, any promised licenses, and the results of any attempt to get a general license for implementers or users are all available from the IETF's online IPR repository at http://www.ietf.org/ipr.

The IETF also invites anyone to flag copyrights, patents, patent applications, or other proprietary rights that might cover technology needed to implement this standard. Send that info to the IETF at ietf-ipr@ietf.org ๐ŸŒธ


Acknowledgement ๐Ÿงš

Funding for the RFC Editor function comes from the IETF Administrative Support Activity (IASA). Thank you, IASA, you're literally the reason these docs get published โœจ๐Ÿ‘‘

๐Ÿ“ฆ where this page comes from