3xx Redirection

HTTP 302 Found

The resource temporarily resides under a different URL. The original URL should still be used.

When is 302 used?

  • Temporary maintenance pages
  • Session-based redirects

How to handle a 302 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 302 from your server

Node.js (Express)

res.status(302).json({ message: 'Found' });

Python (Flask)

return {"message": "Found"}, 302

Go (net/http)

w.WriteHeader(302)

Frequently Asked Questions

What does HTTP 302 mean?

302 Found: The resource temporarily resides under a different URL. The original URL should still be used.

Is 302 an error?

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