Location field
Location identifies a URI reference associated with a redirect or successful creation.
- redirects
- fields
Meaning
Location refers to a specific resource in relation to the response. In a 3xx
response it gives the preferred target for automatic redirection. In 201 Created
it identifies the primary resource created by the request.
Location: ../manual/current?lang=en
Expected result: the recipient resolves the relative reference against the original target URI. It must not treat the value as an already absolute URL.
Fragments
When redirect processing combines fragment identifiers, clients follow the rules in the status definition. Generate a complete intentional target instead of depending on accidental fragment inheritance.
Common mistake
Location does not cause a redirect without a status whose semantics call for
redirection. Likewise, a redirect status with a malformed or unintended target
can fail even though the response itself is valid HTTP.
