307

Temporary Redirect

3xx Redirection

Back to list

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

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

Examples

Temporary write reroute

Request:PATCH /api/orders/123
Response:307 Temporary Redirect with Location: /maintenance/orders/123

The server preserves request semantics while moving traffic for a limited time.

References

Related 3xx Redirection Codes