HTTP 307 Temporary Redirect
HTTP 307 Temporary Redirect is a temporary redirect that strictly preserves the HTTP method and body of the original request. A POST to the original URL becomes a POST to the redirect destination. This is the defining difference from 302 Found, which changes POST to GET in browser implementations.
Quick reference
| Code | 307 |
|---|---|
| Name | Temporary Redirect |
| Category | 3xx Redirect |
| Specification | RFC 9110 §15.4.8 |
| IANA status | Assigned |
| Cacheable | No — not cached by default |
| Client action | Follow the Location header using the same HTTP method and body as the original request. |
| In-depth guide | HTTP 307 full guide → |
What HTTP 307 means
RFC 9110 defines 307 as indicating 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. This is the "MUST NOT" that distinguishes 307 from 302 — the method is contractually preserved.
307 was introduced specifically to address the 302 method-change problem. RFC 2616 said 302 should preserve the method, but browsers changed POST to GET on 302 redirects because web applications expected this behavior (and relied on it for the Post/Redirect/Get pattern). Rather than fix 302, HTTP/1.1 introduced 307 as the strict method-preserving temporary redirect.
The result: use 302 when you want a POST-to-GET redirect (or just a temporary redirect without method preservation). Use 307 when you explicitly need the method preserved — redirecting a POST to another POST endpoint, redirecting a PUT to a different PUT URL, or preserving any non-GET method in a redirect chain.
When to use 307 vs 302 vs 303
| Code | Method after redirect | Typical use |
|---|---|---|
| 302 | GET (in practice) | Generic temporary redirect, expected to become GET |
| 303 | GET (explicitly) | After POST, redirect to GET result page (Post/Redirect/Get) |
| 307 | Same as original | Temporary redirect that must preserve method (POST → POST) |
Practical examples for 307: an authentication gateway that temporarily redirects API calls (including POST and PATCH) to a different region during a failover event. A load balancer that temporarily routes specific POST endpoints to a different server for capacity reasons. HTTPS enforcement where you need to redirect HTTP POST to HTTPS POST without losing the method.
307 and HTTPS enforcement
A common use of 307 is HTTPS enforcement on API endpoints that accept POST requests. A server configured to enforce HTTPS can redirect HTTP requests to HTTPS. For GET requests, 301 is fine. For POST requests that should not change to GET, 307 preserves the method and body. For this to work correctly, the client must resend the POST body to the HTTPS URL.
HSTS (HTTP Strict Transport Security) eliminates the need for this redirect entirely — the browser pre-upgrades to HTTPS before making the request. But during the HSTS rollout period, a 307 redirect handles existing HTTP bookmarks and links that send POST requests.
FAQ
What does HTTP 307 Temporary Redirect mean?
HTTP 307 means the resource is temporarily at a different URL, and the client must use the same HTTP method and body when following the redirect. Unlike 302, the method is guaranteed not to change.
When should I use 307 instead of 302?
Use 307 when you need the method preserved — specifically when redirecting POST, PUT, PATCH, or DELETE requests and the destination endpoint also expects the same method. Use 302 for general temporary redirects where becoming GET is acceptable.
Does 307 work for GET requests?
Yes. For GET requests, 307 and 302 behave identically — GET stays GET in both cases. The difference only matters for non-GET methods.
Is 307 the permanent method-preserving version?
No. For a permanent method-preserving redirect, use 308 Permanent Redirect. 308 is to 307 as 301 is to 302 — permanent with method preservation.
Related resources
On this site: HTTP 307 Temporary Redirect — full guide · HTTP 302 Found · HTTP 303 See Other · HTTP 308 Permanent Redirect · All 3xx redirect codes
Comparisons: 302 vs 307 · 301 vs 307 · 303 vs 307
Standards: RFC 9110 §15.4.8 · IANA HTTP Status Code Registry · MDN Web Docs: 307