Temporary Redirect
3xx Redirection
Last updated:
Like 302 but explicitly preserves the request method (POST stays POST, etc.).
Description
Introduced to remove the ambiguity in 302. If a POST is redirected via 307, the client re-issues the POST at the new URL rather than converting to GET.
When to use
Use 307 for temporary redirects that must preserve HTTP method, such as maintenance redirects for a POST endpoint.
Specification
RFC 9110 §15.4.8
Examples
HTTP response
HTTP/1.1 307 Temporary Redirect Content-Type: application/json Location: /new-url
Node.js (Express)
res.status(307).redirect("/new-url");Go (net/http)
w.WriteHeader(http.StatusTemporaryRedirect)
Python (Flask)
return jsonify({"error": "Temporary Redirect"}), 307Related status codes
302303308
Found
The resource is temporarily at a different URL. The client should continue to use the original URL for future requests.
See Other
The response to the request can be found under a different URL, and the client should perform a GET to that URL.
Permanent Redirect
Like 301 but explicitly preserves the request method.