302

Found

3xx Redirection

Back to list

Server perspective

Use 302 for temporary redirects when you are comfortable with traditional redirect behavior and the original URI should remain the one clients keep using.

When to use

  • Return 302 for temporary page moves and lightweight browser redirects
  • Prefer 307 when method preservation matters, and 303 when you want the next request to be GET

How to respond

  • Include a Location header with the temporary target URI
  • Keep the original URI valid for future requests because the redirect is not permanent

Headers to consider

  • Location
  • Cache-Control

Response body

  • A short explanatory body is optional, but the redirect target belongs in Location

Server-side pitfalls

  • Do not rely on 302 to preserve POST, PUT, or PATCH semantics across clients
  • Do not use 302 when the move is effectively permanent

Examples

Temporary login detour

Request:GET /reports
Response:302 Found with Location: /login?next=/reports

The user is temporarily redirected while the original report URL remains the destination they ultimately care about.

References

Related 3xx Redirection Codes