Actions

::HTTP location

::concepts

Source::example    Location::nowiki    Title::request    Protocol::transfer    Header::location    Force::internet

The HTTP Location header field is returned in responses from an HTTP server under two circumstances:

  1. To ask a web browser to load a different web page (URL redirection). In this circumstance, the Location header should be sent with an HTTP status code of 3xx. It is passed as part of the response by a web server when the requested URI has:
    • Moved temporarily;
    • Moved permanently; or
    • Processed a request, e.g. a POSTed form, and is providing the result of that request at a different URI
  2. To provide information about the location of a newly created resource. In this circumstance, the Location header should be sent with an HTTP status code of 201 or 202.<ref name="RESTful Web Services">{{#invoke:citation/CS1|citation

|CitationClass=book }}</ref>

An obsolete version of the HTTP 1.1 specifications (IETF RFC 2616) required a complete absolute URI for redirection.<ref name="rfc2616sec1430">"Location". Hypertext Transfer Protocol -- HTTP/1.1. IETF. June 1999. sec. 14.30. RFC 2616. https://tools.ietf.org/html/rfc2616#section-14.30. </ref> The IETF HTTP working group found that the most popular web browsers tolerate the passing of a relative URL<ref name="httpbisticket185>IETF HTTPbis Working Group Ticket 185</ref> and, consequently, the updated HTTP 1.1 specifications (IETF RFC 7231) relaxed the original constraint, allowing the use of relative URLs in Location headers.<ref name="rfc7231sec712">"Location". Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content. IETF. June 2014. sec. 7.1.2. RFC 7231. https://tools.ietf.org/html/rfc7231#section-7.1.2. </ref>


HTTP location sections
Intro   Examples    See also    References   

PREVIOUS: IntroNEXT: Examples
<<>>