Quick answer
HTTP 302 Found means the resource is temporarily at a different URL. The client should keep using the original URL for future requests.
What HTTP 302 means
302 Found is a temporary redirect. The resource lives at the original URL but should be fetched from the Location URL for now. Unlike 301, search engines do not transfer ranking and clients should not update their stored URL.
Common causes
- Temporarily redirecting users (e.g. to a maintenance or login page)
- A/B testing or geo-based routing
- Post-login redirects back to the requested page
Response body
Redirects usually have no JSON body — the Location header carries the temporary URL.
Raw HTTP response
HTTP/1.1 302 Found
Location: https://example.com/login
Content-Type: text/html
How to handle HTTP 302
- ✓ Follow the
Locationheader for this request only - ✓ Keep using the original URL for future requests
- ✓ Use 302 for temporary redirects, 301 for permanent ones
- ✓ If the method must be preserved, consider 307 Temporary Redirect instead
302 vs 307 — the method-change gotcha
The historical wrinkle with 302 is method handling. The original HTTP spec said clients should repeat the request with the same method, but in practice browsers and libraries routinely turned a POST into a GET when following a 302. 307 Temporary Redirect was introduced to remove the ambiguity — it guarantees the method and body are preserved.
| Code | Duration | Method on redirect |
|---|---|---|
| 302 Found | Temporary | May change POST→GET (client-dependent) |
| 307 Temporary Redirect | Temporary | Always preserved |
| 301 / 308 | Permanent | 301 may change; 308 preserved |
So for a temporary redirect after a POST (for example, redirecting back after login), reach for 307 if the method must survive; use 302 for ordinary GET redirects.
Handling a 302 in client code
Browsers and most HTTP libraries follow 302s automatically. When you need to see the redirect instead of following it (e.g. to read the Location), disable auto-follow:
// fetch: inspect the redirect instead of following it
const res = await fetch('/dashboard', { redirect: 'manual' });
if (res.status === 302) {
const target = res.headers.get('Location');
}
// curl: show headers without following
// curl -sI https://example.com/dashboard
Frequently Asked Questions
What is the difference between 301 and 302?
301 is a permanent move — update references and search engines transfer ranking. 302 is temporary — keep using the original URL and no ranking is transferred. Choose based on whether the move is permanent.
Does 302 change the HTTP method on redirect?
Historically many clients changed POST to GET on a 302. If you need to preserve the method, use 307 Temporary Redirect, which guarantees the method and body are kept.
Is 302 bad for SEO?
A 302 tells search engines the move is temporary, so ranking stays with the original URL. If the move is actually permanent, using 302 instead of 301 can prevent the new URL from gaining the ranking it should.
When should I use 307 instead of 302?
Use 307 Temporary Redirect when the redirect follows a non-GET request (like a POST) and the method and body must be preserved. 302 may downgrade a POST to a GET on some clients; 307 guarantees it won't.
How do I stop fetch or curl from following a 302 automatically?
In fetch, pass { redirect: 'manual' } to see the 302 and read its Location header instead of following it. With curl, omit -L (and use -I to print headers) so it shows the redirect rather than following it.
Working with a JSON API response?
Format and inspect any response in your browser — nothing is uploaded.