307 Temporary Redirect
Usage
The 307 Temporary Redirect status code indicates the target resource is available at a different URL. The client makes a new request to the URL specified in the Location header and is not permitted to change the request method. This differs from the 302 status code, which allows the client to switch from POST to GET.
When the desired behavior is to change the request method, the 303 status code is the recommended alternative. For example, redirecting a POST form submission to a confirmation page uses 303 with a GET follow-up.
The client must repeat the exact same method, headers, and body to the new URL. The server processes the redirected request normally. Because the 307 Temporary Redirect is not persistent, future requests are expected to use the original URL and revalidate the temporary change.
The permanent counterpart is 308, which preserves the request method identically but signals the move is permanent and clients update stored links.
The response is not cacheable by default. To make the redirect cacheable, add a Cache-Control or Expires header.
The 307 Temporary Redirect status code also serves as an internal redirect when an HSTS policy is declared through the Strict-Transport-Security header or the HSTS preload list. The client uses the status code for redirection from HTTP to a secure connection using HTTPS without contacting the server.
Example
The client requests a resource and the server responds with 307 Temporary Redirect because the resource is available at an alternate location.
Request
GET /news.html HTTP/1.1
Host: example.com
Response
HTTP/1.1 307 Temporary Redirect
Location: http://example.com/breaking/news.html
Code references
.NET
HttpStatusCode.TemporaryRedirect
Rust
http::StatusCode::TEMPORARY_REDIRECT
Rails
:temporary_redirect
Go
http.StatusTemporaryRedirect
Symfony
Response::HTTP_TEMPORARY_REDIRECT
Python3.5+
http.HTTPStatus.TEMPORARY_REDIRECT
Apache HttpComponents Core
org.apache.hc.core5.http.HttpStatus.SC_TEMPORARY_REDIRECT
Angular
@angular/common/http/HttpStatusCode.TemporaryRedirect