307

HTTP 307 Temporary Redirect

3xx Redirection

3xx Redirection RFC 7231, Section 6.4.7

What is HTTP 307 Temporary Redirect?

The 307 (Temporary Redirect) status code is similar to 302 Found, but with a crucial difference: the user agent must not change the HTTP method of the original request. If the original request was POST, the redirect request must also be POST. This ensures that form data is not lost during a temporary redirect.

Common Use Cases

  • Temporary redirects preserving POST method
  • API redirects where method must be preserved
  • Redirecting form submissions without data loss

Usage Example

When a server needs to redirect a POST request temporarily to another endpoint for processing (e.g., during a blue-green deployment or maintenance window), use 307 Temporary Redirect. The client will re-POST the same data to the new URL without losing the request body.

// Laravel - temporary redirect preserving method
return redirect()
    ->away('https://backup.example.com/api/process')
    ->setStatusCode(307);

// This preserves POST/PUT/DELETE methods through the redirect

Common Mistakes

⚠️

Mistake: Using 302 instead of 307 when POST data must be preserved

Fix: Most browsers change POST to GET when following 302. If you need to preserve the original HTTP method (especially POST), always use 307 Temporary Redirect.

⚠️

Mistake: Using 307 for permanent redirects

Fix: If the redirect is permanent, use 308 Permanent Redirect instead of 307. 307 implies the original URL should be used for future requests.

Last updated: 21 Jun 2026