Temporary Redirect
Redirection (3xx)The 307 Temporary Redirect status code indicates that the resource is temporarily at a different URL, and the client must use the same HTTP method for the redirected request. Unlike 302, a 307 redirect guarantees that the request method (POST, PUT, etc.) will not be changed during the redirect. This is important for API redirects and form submissions.
What is HTTP 307 Temporary Redirect?
HTTP 307 Temporary Redirect is a redirection (3xx) status code. The 307 Temporary Redirect status code indicates that the resource is temporarily at a different URL, and the client must use the same HTTP method for the redirected request. Unlike 302, a 307 redirect guarantees that the request method (POST, PUT, etc.) will not be changed during the redirect. This is important for API redirects and form submissions. Common causes include api endpoint temporarily moved and load balancer routing. This response indicates the server processed the request as expected.
Example Response
HTTP/1.1 307 Temporary Redirect Location: https://api.example.com/v2/resource
Common Causes
- • API endpoint temporarily moved
- • Load balancer routing
- • HTTPS enforcement (temporary)
- • Form action redirect preserving POST method
What to Know
- 1. If the redirect is permanent, use 308 instead
- 2. Ensure the Location header points to the correct temporary URL
- 3. Verify your client follows the redirect with the same method
- 4. Check load balancer configuration if 307s appear unexpectedly
Frequently Asked Questions
What is the key difference between 302 and 307?
307 guarantees the HTTP method is preserved. A POST request redirected with 307 will remain a POST. With 302, some clients may change POST to GET, which can break form submissions and API calls.
When should I use 307 over 302?
Use 307 when the request method must be preserved, especially for POST, PUT, and DELETE requests. For simple GET redirects, 302 and 307 behave the same.
Do all browsers support 307?
Yes, all modern browsers support 307. It was introduced in HTTP/1.1 specifically to address the method-changing behavior of 302.