Reference guide · http-status · Published 2026-08-16 · 3 min read
HTTP 307 temporary redirect
HTTP 307 temporary redirect explained: it preserves the method and body, where it beats 302, and how to configure and test it.
- ·What 307 holds
- ·307 vs 302 vs 308
- ·When to use it
What 307 means
307 Temporary Redirect is a 30x family response that moves the client to a Location header, for a short time, while keeping the HTTP method and body intact. It is the temporary cousin of 308: the same "keep the method" guarantee, but where 308 promises permanence, 307 is explicitly temporary, and the client should keep asking the original URL later.
The browser, API client and search engine behave the same on a 307 as they do on a 302, except for one decisive difference: the method does not change. Where an old-style 302 (and 301) may turn a POST into a GET, a 307 re-sends the same verb and body to the new location.
The decisive difference: the method
| Code | Meaning | POST after redirect | Cacheable |
|---|---|---|---|
| 302 | Found (temporary) | Often becomes GET | Usually no |
| 307 | Temporary redirect | Keeps POST | Usually no |
| 308 | Permanent redirect | Keeps POST | Yes |
Browsers historically rewrite 302 semantics in ways that surprise: a login form, a payment submit or a multipart upload that gets a 302 can end up as a GET to the new URL with the body discarded. A 307 removes that ambiguity for the temporary case, and it is the method-preserving choice that keeps the same verb and body intact.
When to reach for 307
- Temporary site maintenance: the site is mid-deploy and you want search to keep the old URL, not to keep a redirected one.
- A webhook or API endpoint temporarily moved (for example to a standby region) where the client must re-send the same
POSTbody:307is the method-preserving temporary choice. - Preserving a form submission during a momentary migration when you do not want search to cache the old address.
Comparing with 308
307= temporary method-preserving redirect.308= permanent, also method-preserving.- Pick on the duration: will the old URL work again? If yes,
307; if it is moving for good,308.
A common slip is to use 307 as if it were permanent or to set a max-age on a 307 that makes a client cache a temporary redirect past its actual life. The temporary family should not be cached aggressively, because a mistimed Cache-Control can freeze a temporary redirect; the redirect methods guide and the redirect map migration article cover when each status belongs.
Configuration examples
# nginx: redirect a moved endpoint for a temporary campaign
location /flash-sale/ {
return 307 https://www.example.com/deals/campaign;
}
# Apache
Redirect 307 /flash-sale/ https://www.example.com/deals/campaign
Verify with curl that the method survived:
curl -i -X POST -d "name=jane" http://example.com/api/order
# HTTP/1.1 307 Temporary Redirect
# location: https://www.example.com/api/order
If the target shows in the request as GET, some layer turned the 307 into a 302. The more complete status list is in the status reference.