307 Temporary Redirect HTTP Status Code

Description

HTTP status code 307 stands for "Temporary Redirect." This status code indicates that the requested resource has been temporarily moved to a different URI (Uniform Resource Identifier). Unlike some other redirect status codes, when a server responds with a 307 status, the method and the body of the original request should be reused in the subsequent request to the new URI. This means, for example, if the original request was a POST request, then the redirected request should also be a POST request, preserving the original request's method.

Here's a simplified breakdown of its characteristics:

  • Temporary: The redirection is only for a short period. The client should continue to use the original URI for future requests.
  • Method Preservation: The HTTP method (e.g., GET, POST) is not changed in the redirected request. If the original request was a POST, the redirected request will also be a POST.
  • Resubmission: If the request method was not GET or HEAD, the client should prompt the user before making the redirected request, since the request might change the state on the server.

This status code is useful in scenarios where resource locations change temporarily or when load balancing mechanisms redirect clients to different servers, all while ensuring that the request method is not altered during the process.

Status

HTTP
307 Temporary Redirect

Common Causes

Here are the primary causes or scenarios where a 307 status code might be used:

  1. Resource Temporarily Moved: The most common cause for a 307 status code is when the resource requested by the client has been temporarily moved to a different URL. This is often used during website maintenance or when the resource is temporarily available at a different location.

  2. Load Balancing: Websites that receive high traffic may use load balancers to distribute requests among several servers to manage the load efficiently. A 307 redirect can be used to temporarily redirect traffic to a different server without changing the request method.

  3. URL Structure Changes: If a website is undergoing a restructuring of its URL schema but needs to ensure that clients can still access resources under their old URLs temporarily, a 307 redirect can be employed to redirect to the new URLs without changing the request method.

  4. Preservation of Request Method: Unlike some other redirect status codes (e.g., 302), which do not strictly require the HTTP method to remain unchanged, a 307 status code explicitly requires that the client repeat the request with the same method and body on the redirected URL. This is particularly important for operations like POST requests where changing the method to GET could lead to unintended consequences.

  5. Preventing Bookmarking of Temporary URLs: By indicating that the redirection is temporary, a 307 status code discourages users and user agents from bookmarking or caching the redirect URL, as it's expected that the original URL will become valid again.

  6. Compliance with User Agent Behavior: Different user agents (browsers, crawlers, etc.) may handle redirects differently. Using a 307 status code can help ensure consistent behavior across user agents by explicitly stating that the method should not be changed during the redirect.

It's important for web developers to use HTTP status codes correctly to ensure proper handling of requests by clients and intermediaries, maintain the semantics of HTTP methods, and provide clear signals about the nature of the redirection (temporary vs. permanent) to both clients and search engines.

Browser Support

The following table will show you the current browser support for the 307 Temporary Redirect HTTP status code.

Desktop
Edge Chrome Firefox Opera Safari
YesYesYesYesYes
Tablets / Mobile
Chrome Firefox Opera Safari Samsung Webview
YesYesYesYesYesYes

Last updated by CSSPortal on: 31st March 2024