HTTP 307 Temporary Redirect — What It Means & How to Debug
HTTP 307 Temporary Redirect preserves the HTTP method and body when redirecting — unlike 302, it guarantees POST/PUT requests are resent with the same method.
What It Means
The HTTP 307 Temporary Redirect status code instructs the client to repeat the request at a different URL, but with one critical rule: the HTTP method and request body must remain unchanged. This is the key difference from 302 Found, which historically allowed browsers to change POST to GET.
When a server returns 307, it includes a Location header with the new URL. The client must resend the exact same request — including headers, method, and body — to the new URL. The redirect is temporary, meaning clients and search engines should continue using the original URL for future requests.
This status code was introduced in HTTP/1.1 to fix the ambiguity of 302. While most modern browsers respect method preservation for 302, the RFC explicitly guarantees it for 307. It is the safe choice when you need to redirect a non-GET request without losing the request payload.
When It’s Sent
- POST form submissions — a form is submitted to a temporary URL that redirects to the processing endpoint
- API load shedding — temporarily redirecting POST/PUT requests to a different server during maintenance
- Authentication redirects — redirecting a POST with credentials to an auth endpoint while preserving the body
- Temporary URL restructuring — moving endpoints during a migration without committing to the change
- Maintenance mode — redirecting write operations to a read-only or fallback endpoint temporarily
Real Example
curl -v -X POST \
-H "Content-Type: application/json" \
-d '{"title":"New Post","body":"Hello"}' \
-L https://api.example.com/submitExpected response:
> POST /submit HTTP/1.1
> Host: api.example.com
> Content-Type: application/json
> Content-Length: 38
>
< HTTP/1.1 307 Temporary Redirect
< Location: https://api.example.com/submit-v2
< Content-Length: 0
<
* Issue another request to this URL:
* POST https://api.example.com/submit-v2
> POST /submit-v2 HTTP/1.1
> Host: api.example.com
> Content-Type: application/json
> Content-Length: 38
>
< HTTP/1.1 201 Created
< Content-Type: application/json
< Content-Length: 36
<
{"status":"created","id":"post-456"}Note that curl’s -L flag follows redirects and correctly resends the POST body for 307, confirming method preservation.
How to Debug
Browser DevTools
- Open Network tab and check Preserve log (redirects may clear the log otherwise)
- Trigger the request that causes the redirect
- Look for the request with status
307 - Check the Headers tab for the
Locationfield - A second request appears — verify its method is POST (not GET)
- Confirm the request body is present in the second request
curl
# Show the redirect without following it
curl -v -X POST -d '{"key":"value"}' \
https://example.com/submit
# Follow the redirect and see if method+body are preserved
curl -v -L -X POST -d '{"key":"value"}' \
https://example.com/submitThe -L flag is essential — without it, curl shows only the redirect response. With -L, it follows the redirect and shows the final response.
Postman
Disable Automatically follow redirects in Settings to see the 307 response, including the Location header. Re-enable it to see the final response. Verify in the Headers tab of the redirected request that POST method and body are preserved.
Common Causes
| Scenario | What Happens | Why It Matters |
|---|---|---|
| Form submission redirect | POST redirects to processing endpoint | Form data is preserved through the redirect |
| API version migration | Old endpoint temporarily redirects to new one | Clients can migrate at their own pace |
| Load balancing | Write operations redirected to primary server | Ensures consistency during failover |
| Maintenance window | All mutating requests redirected to status page | Prevents data loss during maintenance |
| Authentication handoff | POST with credentials redirected to auth service | Credentials are preserved in the redirect |
FAQ
Related Codes
- HTTP 301 Moved Permanently — permanent redirect, may change POST to GET
- HTTP 302 Found — temporary redirect, may change POST to GET
- HTTP 308 Permanent Redirect — permanent redirect, preserves method
- HTTP 303 See Other — forces GET after POST for form results
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro