307 Temporary Redirect

Same as 302 but the request method and body must be preserved when following the redirect.

Status

HTTP/1.1 307 Temporary Redirect

Details

307 was created to remove the ambiguity in 302. The move is temporary, and the client is explicitly forbidden from changing the method: a POST to the old URL becomes a POST to the new one, with the same body.

That makes it the right code for temporarily relocating an API endpoint, for maintenance failover, and for any redirect where dropping the request body would break the operation. HSTS preloading also relies on method-preserving upgrades of this kind.

Headers

Common causes

How to fix it

As the client

As the server

Examples

POST /v1/ingest HTTP/1.1
Host: api.example.com
Content-Type: application/json

{"event":"click"}

HTTP/1.1 307 Temporary Redirect
Location: https://api-eu.example.com/v1/ingest

Specifications

RFC 9110 §15.4.8

See also