World Library  
Flag as Inappropriate
Email this Article

HTTP location

Article Id: WHEBN0022800393
Reproduction Date:

Title: HTTP location  
Author: World Heritage Encyclopedia
Language: English
Subject: Location, HTTP 301, HTTP 302, HTTP 303, List of HTTP header fields
Publisher: World Heritage Encyclopedia

HTTP location

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.[1]

An obsolete version of the HTTP 1.1 specifications (IETF RFC 2616) required a complete absolute URI for redirection.[2] The IETF HTTP working group found that the most popular web browsers tolerate the passing of a relative URL[3] and, consequently, the updated HTTP 1.1 specifications (IETF RFC 7231) relaxed the original constraint, allowing the use of relative URLs in Location headers.[4]


Absolute URL example

Absolute URLs are URLs that start with a scheme[5] (e.g., http:, https:, telnet:, mailto:)[6] and conform to scheme-specific syntax and semantics. For example, the HTTP scheme-specific syntax and semantics for HTTP URLs requires a "host" (web server address) and "absolute path", with optional components of "port" and "query".

Client request:

GET /index.html HTTP/1.1

Server response:

HTTP/1.1 302 Found

Relative URL example

Relative URLs are URLs that do not include a scheme or a host. In order to be understood they must be combined with the URL of the original request.

Client request for

GET /blog HTTP/1.1

Server response:

HTTP/1.1 302 Found
Location: /articles/

The URL of the location is expanded by the client to

See also


  1. ^ Richardson, Leonard (2007). RESTful Web Services. Sebastopol: O'Reilly. pp. 228–230. ISBN . 
  2. ^ "Location". Hypertext Transfer Protocol -- HTTP/1.1. IETF. June 1999. sec. 14.30. RFC 2616.
  3. ^ IETF HTTPbis Working Group Ticket 185
  4. ^
  5. ^ Uniform Resource Identifier (URI): Generic Syntax. IETF. January 2005.
  6. ^ "IANA Uniform Resource Identifer (URI) Schemes". Retrieved 2014-11-21. 
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.

Copyright © World Library Foundation. All rights reserved. eBooks from Project Gutenberg are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.