307 Temporary Redirect
The 307 Temporary Redirect status code is used by servers to inform the client that the requested resource has been temporarily moved to a new location.
The 307 Temporary Redirect status code is used by servers to inform the client that the requested resource has been temporarily moved to a new location.
This status code was introduced in the HTTP/1.1 specification. Unlike the 301 Moved Permanently status code, which indicates a permanent move, the 307 Temporary Redirect implies that the original location may become available again in the future.
The 307 Temporary Redirect status code is used when a resource has temporarily moved to a different URL. The client is expected to make a new request to the URL specified in the Location header, keeping the same HTTP method and message body.
Unlike the 302 Found status code, the 307 status code ensures that the method and body are not altered in the follow-up request. It is important to note that the 307 status code is not cached by default, and if caching is desired, Cache-Control or Expires headers should be added.
Additionally, the 307 status code can be used for internal redirects when implementing HSTS policies or redirecting from HTTP to HTTPS.
In the example, the client asks the server for a particular resource. However, the server tells the client that the resource is temporarily moved to a different location.
The client is instructed to make a new request to the provided alternate location to get the resource.
Request
GET /news.html HTTP/1.1
Host: www.example.com
Response
HTTP/1.1 307 Temporary Redirect
Location: http//www.example.com/breaking/news.html
The 307 Temporary Redirect status code indicates that the requested resource has been temporarily moved to a different location.
The client should make a new request to the new URL specified in the response to access the resource, while keeping the original HTTP method and message body unchanged.