Location headers redirect the user agent to retrieve another URI reference when used with 3xx
redirection status codes, except for 304 Not Modified
. Both absolute URIs and relative references can be provided, including empty references which refer to the current resource (see the URI specification for further information).
Still, only Firefox and old Edge accept empty Location headers; the new Edge and Chrome don't. Although HTTP redirects are only meant to redirect to different resources or URIs (see RFC 7231 section 6.4), all browsers implement non-empty Location headers that explicitly refer to the same page.
Whenever the user agent receives a redirection status code but no Location header (or an invalid Location header or in the case of Chrome, an empty Location header) it will not redirect but show the response body. This also applies when the user disables automatic redirection. Therefore the response body should also include the respective link.
Empty Location headers may obviously introduce redirect loops. Nevertheless, the status code 303 See Other
could be used in conjunction with an empty Location header to implement the Post/Redirect/Get idiom using the very same URI. This idiom prevents users from resubmitting the same form using POST when reloading the page because 303 See Other
requires the user agent to use the GET request method when following the new Location. 301 Moved Permanently
and 302 Found
may also change the request method to GET (but they also may not); 307 Temporary Redirect
and 308 Permanent Redirect
never change the request method.
While this use case seems kind of elegant I would not recommend to implement it because browser support diverges.