The resource is temporarily at another URL.
When to use it
Short-lived redirects. Clients may change POST to GET; prefer 303 or 307 to be explicit.
Good to know
Use 302 when the original URL will come back: a temporary maintenance page, an A/B test, a login redirect or language selection. Search engines keep the original URL indexed, though Google starts treating a 302 that stays for months as permanent. Browsers don’t cache a 302 unless Cache-Control or Expires says so, which makes it the safe choice while you are still testing redirects.
Browsers historically rewrite a POST to GET when following a 302 and drop the body, and the spec now allows it. If the method must survive, use 307; after a form submit, use 303 to be explicit. A common bug is a redirect loop between http and https, or www and the bare domain, often caused by a proxy or Cloudflare Flexible SSL. Follow the chain with curl -IL.
Redirection (3xx)
3xx codes are redirections: the client has to go somewhere else, or use its cached copy, to finish the request.
What it looks like
HTTP/1.1 302 FoundHow to send it
| Node.js / Express | res.redirect(302, '/new-url') |
|---|---|
| Python / Flask | return redirect('/new-url', code=302) |
| nginx | return 302 https://example.com$request_uri; |
How to check it
curl -s -o /dev/null -w "%{http_code}\n" https://example.com/