// http 3xx · redirection

HTTP 307 Temporary Redirect

Temporary redirect that preserves the HTTP method.

What HTTP 307 Temporary Redirect means

307 Temporary Redirect is like 302 but with a guarantee: the client must repeat the request at the new URL using the same HTTP method and body. Use it for temporary redirects of POST/PUT requests where the method must not change.

Which category is it?

307 is a 3xx code — Redirection. 3xx means further action is needed to complete the request, usually because the resource lives at a different URL.

Example 307 response

POST /api/v1/items HTTP/1.1

HTTP/1.1 307 Temporary Redirect
Location: https://api2.example.com/v1/items

How to check a 307

  1. Use curl -i -X POST --data '{}' with -L enabled and confirm the method stays POST after the redirect.
  2. Check the Location header and that the temporary target accepts the same method and body.
  3. HSTS upgrades in browsers can show an internal 307 for HTTP to HTTPS. That one is generated by the browser and never reaches the network.

307 compared with similar codes

  • 302: Both are temporary. 307 forbids changing the method, while 302 allows clients to change POST to GET.
  • 308: 308 is the permanent counterpart of 307.

307 Temporary Redirect: common questions

Why does Chrome show 307 Internal Redirect?

That is HSTS at work: the browser already knows the site must use HTTPS and rewrites the HTTP request itself, without asking the server.

Other redirection (3xx) codes