views:

975

answers:

2

Confused/inspired by a comment to my question Do search engines respect the HTTP header field “Content-Location”?, I’d like to know, what the exact purpose of the Content-Location header field in HTTP is and how it can be used.

+4  A: 

Content-Location in HTTP can be used when a requested resource has multiple representations available, e.g. multiple languages. The selection of the resource returned will depend on the Accept headers in the original GET request.

Usually, the location specified in the Content-Location header is different to the location specified in the original request's URI.

I don't believe that Content_Location has any defined behaviour in response to a PUT or POST request.

HTH

cheers,

Rob

Rob Wells
Indeed, HTTP RFC say that there is no defined behaviour of Content-Location for PUT and POST.
ordnungswidrig
+3  A: 

Section 14.14 of RFC 2616 states:

"The Content-Location entity-header field MAY be used to supply the resource location for the entity enclosed in the message when that entity is accessible from a location separate from the requested resource's URI..."

This is used in AtomPub (RFC 5023, Section 9.2):

"If the creation request contained an Atom Entry Document, and the subsequent response from the server contains a Content-Location header that matches the Location header character-for-character, then the client is authorized to interpret the response entity as being a complete representation of the newly created Entry. Without a matching Content-Location header, the client MUST NOT assume the returned entity is a complete representation of the created Resource."

Julian Reschke
Please note that the behaviour described in AtomPub regarding completeness of the representation is not backed by the HTTP spec.
ordnungswidrig