3xx Redirection

HTTP 307 Temporary Redirect

The resource temporarily resides under a different URL. The method must not change.

When is 307 used?

  • Temporary redirects preserving POST method
  • Login-required page redirects

How to handle a 307 response

Follow the Location header. Most HTTP clients do this automatically, and curl -L follows redirects on the command line. Update links and sitemaps that point at permanently redirected URLs.

Check the status code a URL returns from the command line:

curl -s -o /dev/null -w "%{http_code}\n" https://example.com

How to return 307 from your server

Node.js (Express)

res.status(307).json({ message: 'Temporary Redirect' });

Python (Flask)

return {"message": "Temporary Redirect"}, 307

Go (net/http)

w.WriteHeader(307)

Frequently Asked Questions

What does HTTP 307 mean?

307 Temporary Redirect: The resource temporarily resides under a different URL. The method must not change.

Is 307 an error?

No. 307 is in the 3xx Redirection class. Redirection: the client must take additional action, usually requesting a different URL.