307

Temporary Redirect

3xx Redirection

ELI5

Go to this other address for now, and send the exact same kind of request there.

Server perspective

Use 307 when the redirect is temporary and the follow-up request must keep the same method and body.

When to use

  • Return 307 for temporary API or infrastructure moves that cannot tolerate method rewriting
  • Choose 307 over 302 when non-GET behavior must remain exact
  • Temporary redirects where the original method and body must be preserved
  • Temporary API endpoint moves for POST, PUT, PATCH, or DELETE
  • Operational rerouting such as maintenance or traffic shifting without changing request semantics

How to respond

  • Include a Location header with the temporary URI
  • Make sure the target endpoint can safely handle the same method and request body

Headers to consider

  • Location
  • Cache-Control

Response body

  • A body is optional, but the redirect target and temporary nature should be clear

Server-side pitfalls

  • Do not use 307 if you actually want the redirected request to switch to GET
  • Do not mark a long-term move as temporary if clients should update their stored URIs
  • Permanent redirects; use 308
  • Cases where the next request should intentionally become GET; use 303
  • Simple temporary browser redirects where method preservation is irrelevant and 302 is acceptable

Examples

Temporary API endpoint move

Request:POST https://api.example.test/api/v1/users
Response:307 Temporary Redirect # Headers Location: https://api.example.test/api/v2/users

The client should repeat the same POST against the temporary target URI.

Temporary upload reroute

Request:PUT https://api.example.test/uploads/123
Response:307 Temporary Redirect # Headers Location: https://api.example.test/edge-2/uploads/123

The request semantics stay intact while the server temporarily shifts traffic.

References

Related Status Codes