| Status code | 307 |
|---|---|
| Status text | Temporary Redirect |
| Category | 3xx Redirection |
| Response has body | Usually |
| Specification | RFC 9110 |
What does 307 Temporary Redirect mean?
Like 302, but the HTTP method and body must be preserved when following the redirect. It belongs to the 3xx Redirection class, which means further action is needed to complete the request, usually following a different URL.
When do APIs return 307?
Temporary redirects where a POST must stay a POST.
How to fix a 307 Temporary Redirect
Nothing to fix. Prefer 307 over 302 for non-GET requests to avoid method rewriting.
Reproduce a 307 response
The fastest way to understand a status code is to trigger one and read the full response. Open the
API tester and send a request to https://httpbin.org/status/307 — you will
see the 307 status along with every response header the server sent. Comparing those headers against
a working request is often what reveals the cause.
When you are debugging a real endpoint, check the response headers as carefully as the body, and confirm you are using the right HTTP method for the operation.
Related 3xx status codes
300 Multiple Choices
The resource has more than one representation, and the server is leaving the choice to the client.
301 Moved Permanently
The resource has permanently moved to the URL in the Location header.
302 Found
The resource is temporarily at a different URL, but future requests should still use the original.
303 See Other
The response to the request can be found at another URL, and should be retrieved with GET.
304 Not Modified
The cached copy the client already has is still valid, so no body is sent.
308 Permanent Redirect
Like 301, but the method and body must be preserved.
307 Temporary Redirect FAQ
What is the difference between 307 and 308?
Both preserve the request method and body. 307 is temporary, so the client keeps using the original URL next time; 308 is permanent, so the client should switch to the new URL.
Why do I see a 307 when I type an http address?
It is usually HSTS. A browser that knows a site is HTTPS-only upgrades the request itself and reports it as an internal 307 redirect, without contacting the server.
When should an API use 307 instead of 302?
Whenever the redirected request might be a POST, PUT or DELETE. 307 guarantees the client repeats the same method and body, which a 302 does not.
See also
- 302 Found — The resource is temporarily at a different URL, but future requests should still use the original.
- 308 Permanent Redirect — Like 301, but the method and body must be preserved.
References
- RFC 9110, 307 Temporary Redirect — The specification that defines this status code.
- MDN: 307 Temporary Redirect — MDN's reference page for this status code.