Content-Location
The HTTP Content-Location header indicates a direct URL for the specific representation returned in the response.
Usage
The Content-Location header provides a URL identifying the particular representation of a resource delivered in the response body. Unlike the Location header, which redirects the client to a different resource, Content-Location points to the exact representation the server chose after content negotiation.
When a server supports multiple representations of the same resource (different languages, formats, or encodings), the Content-Location header tells the client which specific variant was selected. This distinction matters for caching and bookmarking the negotiated result.
The value is either an absolute URL or a relative reference resolved against the request URL. A relative reference is more common in practice.
Content-Location also appears in responses to PUT and POST requests. After a successful POST creates a new resource, the server sets Content-Location to the URL of the newly created item when the response body represents the created resource directly.
Example
A client requests a document at /report and the server
selects the English PDF variant through content negotiation.
The
Content-Location header identifies the specific URL of
the chosen representation.
GET /report HTTP/1.1
Host: example.re
Accept: application/pdf
Accept-Language: en
HTTP/1.1 200 OK
Content-Type: application/pdf
Content-Language: en
Content-Location: /report/en.pdf
After a POST request creates a new resource, the server returns the created item in the response body. The Content-Location header points to the canonical URL for the new resource.
HTTP/1.1 201 Created
Content-Type: application/json
Content-Location: /orders/12345
Takeaway
The Content-Location header identifies the direct URL of the specific representation returned in the response, supporting content negotiation, Caching, and resource creation workflows.