Location Header

Table of Content

The Location header is an HTTP response header used to redirect the client to a specific URL. It often accompanies a 3XX HTTP status code, indicating a redirection. This header essentially tells the client where the requested resource has been moved. Aside from redirection, it can be used to indicate the URL where a newly created resource is located.


HTTP/1.1 3XX Object moved
Location: http://www.example.com


The Location header does not have any directives. It contains the URL of a redirect target or newly created resource.


In case of redirection.

HTTP/1.1 301 Moved Permanently
Location: https://www.example.com/newpage

For a new resource.

HTTP/1.1 201 Created
Location: https://www.example.com/newpage/1

Browser Compatibility

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

How to modify Location header

ModHeader is a Chrome extension which can be used to modify HTTP request and response headers. With ModHeader, you can add, modify, and remove headers that control browser behaviour, including the Location header.

Here is a simple example:

  1. Open ModHeader, click on 'Add' button on Request Headers.
  2. In the 'Name' field, enter 'Location'.
  3. In the 'Value' field, enter the URL you wish to set, for example 'https://www.example.com/newpage'.
  4. Now whenever your browser makes an HTTP request, it will include this new Location header.

This ability to modify the Location header can be helpful for testing how your application responds to different redirect scenarios without needing to modify server-side code.