302 Found
When a resource is temporarily available at a different URL, the server responds with 302 Found, previously known as "Moved Temporarily". The client follows the Location header to reach the resource. Because the response is temporary, the URI is revalidated on each subsequent request.
Usage
When the 302 Found status code is received, the client understands the requested resource has temporarily moved. A second request retrieves the resource at the new location. This is simpler than a 301 because the client is not expected to update internal links.
Common triggers for 302 responses include HTTP-to-HTTPS upgrades (often better served by 301), URL normalization (trailing slash), A/B testing, geolocation-based content routing, and temporary maintenance redirects.
Example
The client requests a resource temporarily moved. The server indicates the new location and supplies a relevant message for client-side display.
Request
GET /news.html HTTP/1.1
Host: www.example.re
Response
HTTP/1.1 302 Found
Location: http://www.example.re/testing/news.html
Content-Type: text/html
Content-Length: 155
<h1>The Newsfeed has moved</h1>
<body>
The site is under development and the newsfeed has
temporarily moved to
<a href=/testing/news.html>here</a>.
</body>
Code references
.NET
HttpStatusCode.Found
Rust
http::StatusCode::FOUND
Rails
:found
Go
http.StatusFound
Symfony
Response::HTTP_FOUND
Python3.5+
http.HTTPStatus.FOUND
Java
java.net.HttpURLConnection.HTTP_MOVED_TEMP
Apache HttpComponents Core
org.apache.hc.core5.http.HttpStatus.SC_MOVED_TEMPORARILY
Angular
@angular/common/http/HttpStatusCode.Found
See also
- RFC 9110: HTTP Semantics
- Google: HTTP status codes and network errors
- 303
- 307
- 301
- Redirects
- HTTP status codes