307 Temporary Redirect: Form POST Measured in 7 HTTP Clients
What happens after a form submission?
After a 307, of 7 measured clients: 6 arrived there as a POST with its body; 1 did not go to the new address.
Read the client results
Read the entries alongside the measurement scope.
Measured on Linux (x86_64, kernel 7.0.0-34-generic) against a local test server, with curl 8.18.0, GNU Wget 1.25.0, Python urllib.request 3.12.13, Python Requests 2.34.2, Python HTTPX 0.28.1, Node.js fetch 20.20.2, Chromium (HTML form) 149.0.7827.55. Windows, macOS, Firefox, Safari, older versions and other settings were not measured.
- curl 8.18.0: after a 307, the request arrived at the new address as a POST with its body.
- GNU Wget 1.25.0: after a 307, the request arrived at the new address as a POST with its body.
- Python urllib.request 3.12.13: after a 307, the client did not go to the new address; it reported HTTPError 307.
- Python Requests 2.34.2: after a 307, the request arrived at the new address as a POST with its body.
- Python HTTPX 0.28.1: after a 307, the request arrived at the new address as a POST with its body.
- Node.js fetch 20.20.2: after a 307, the request arrived at the new address as a POST with its body.
- Chromium (HTML form) 149.0.7827.55: after a 307, the request arrived at the new address as a POST with its body.
Compare the reference text and measured totals
How do the reference passages and results compare?
“Note: For historical reasons, a user agent MAY change the request method from POST to GET for the subsequent request. If this behavior is undesired, the 307 (Temporary Redirect) status code can be used instead.” — RFC 9110 §15.4.3
“It is primarily used to allow the output of a POST action to redirect the user agent to a different resource, since doing so provides the information corresponding to the POST response as a resource that can be separately identified, bookmarked, and cached.” — RFC 9110 §15.4.4
- After a 301, of 7 measured clients: 7 arrived there as a GET without a body.
- After a 302, of 7 measured clients: 7 arrived there as a GET without a body.
- After a 303, of 7 measured clients: 7 arrived there as a GET without a body.
- After a 308, of 7 measured clients: 6 arrived there as a POST with its body; 1 did not go to the new address.
Decide what your form workflow needs
Read the passages below against what your form is meant to do.
If the form data has to reach the new address, answer with 307 or 308: in this measurement, whenever a client went on to the new address after a 307 or 308, a POST with its body arrived there; after a 301, 302 or 303, a GET without a body arrived.
What about a different sending tool?
If your code posts with Python's urllib.request, handle 307 and 308 yourself: in this measurement it raised an error instead of going to the new address.
Line up what your form has to deliver with the entries in the client list and the scope note, then match that picture to the decision passages above.
Does a 307 redirect keep the POST body?
“The 307 (Temporary Redirect) status code indicates that the target resource resides temporarily under a different URI and the user agent MUST NOT change the request method if it performs an automatic redirection to that URI.” — RFC 9110 §15.4.8