HTTP 302
HTTP |
---|
Request methods |
Header fields |
Response status codes |
Security access control methods |
Security vulnerabilities |
The HTTP response status code 302 Found is a common way of performing URL redirection. The HTTP/1.0 specification (RFC 1945) initially defined this code, and gave it the description phrase "Moved Temporarily" rather than "Found".
An HTTP response with this status code will additionally provide a URL in the header field Location. This is an invitation to the user agent (e.g. a web browser) to make a second, otherwise identical, request to the new URL specified in the location field. The end result is a redirection to the new URL.
Many web browsers implemented this code in a manner that violated this standard, changing the request type of the new request to
As a consequence, RFC 7231 (the update of RFC 2616) changes the definition to allow user agents to rewrite POST to GET.[3]
Example
Client request:
GET /index.html HTTP/1.1
Host: www.example.com
Server response:
HTTP/1.1 302 Found
Location: http://www.iana.org/domains/example/
See also
References
- ^ Lawrence, Eric. "HTTP Methods and Redirect Status Codes". EricLaw's IEInternals blog. Retrieved 2011-08-20.
- ^ "Request and response objects | Django documentation | Django". Docs.djangoproject.com. Retrieved 2014-06-23.
- ^ "Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content". Tools.ietf.org. Retrieved 2019-01-05.
External links
- RFC 9110 HTTP Semantics