Content-Location Header

Table of Content

The Content-Location header in HTTP is used to redirect the potential applicable purview of the response message, or to redefine the original resource to be returned. Essentially, its purpose is to indicate the exact location where the original or duplicate of the requested resource is located. It's essential to note that this location could be in the same or a different server, and is used to optimize performance or perform load balancing among other server-side strategies.

Syntax

Content-Location: <URL>

Directives

With the Content-location header, the main directive is that the <URL> should specify the direct location of the requested resource, providing the specific URI.

Examples

To refer to the specific location of a resource:

Content-Location: /index.html

Or a more specific location within versions of resource:

Content-Location: /index_v2.html

Browser Compatibility

Browser Compatibility
Chrome Supported
Firefox Supported
Safari Supported
Opera Supported
Edge Supported

How to modify Content-Location header

ModHeader is a powerful Chrome extension used to modify HTTP request and response headers.

To start with, ensure the ModHeader extension has been added to your browser. Open the extension by clicking on its icon, where you're directed to a panel with a section for response and request headers.

To modify the Content-Location header, use the response headers section. Click 'Add' button then enter 'Content-Location' as the header name and your desired URL as the value, for instance http://example.com/resources.

This is useful especially in testing web applications to simulate different server responses without having to configure the server itself to send specific headers or values. You can easily emulate location-based responses or test how your application behaves when the requested resource's location is externally specified.