Skip to content

302 Found — Meaning, Common Causes & How to Fix

302 3xx Redirection RFC 9110 §15.4.3

302 Found means: The resource is temporarily available at a different URI. Clients should keep using the original URI for future requests because the move is not permanent; like 301, user agents historically may rewrite POST to GET when following it. Redirection 3xx codes tell the client the resource lives elsewhere, or that a cached copy is still valid. The family splits along two axes: permanent versus temporary, and method-preserving versus method-rewriting. Picking the wrong member causes duplicate submissions, lost POST bodies or stale SEO signals. In practice you will meet 302 when a login flow redirects to an identity provider and back; a temporary maintenance or campaign page stands in for the real one; a/b testing or geo-routing sends users to a variant temporarily. On the client side, follow Location for this request only; do not permanently rewrite stored URLs. Preserve method with 307 if the API requires it. On the server side, use 302 for genuinely temporary moves; mark it non-cacheable unless you add explicit freshness, and prefer 307 for method-preserving redirects.

Advertisement
Ad slot · ref-top

When 302 happens

  • A login flow redirects to an identity provider and back
  • A temporary maintenance or campaign page stands in for the real one
  • A/B testing or geo-routing sends users to a variant temporarily

How to fix it

On the client

Follow Location for this request only; do not permanently rewrite stored URLs. Preserve method with 307 if the API requires it.

On the server

Use 302 for genuinely temporary moves; mark it non-cacheable unless you add explicit freshness, and prefer 307 for method-preserving redirects.

Should you retry?

Follow the redirect (or reuse the cache for 304); update references if permanent.

Debugging steps

When 302 appears unexpectedly, start by capturing the full exchange: 'curl -i' or the browser DevTools Network tab shows the exact status line and response headers, which often carry the real explanation. Inspect the Location header and count redirect hops: chains and loops are the usual culprits, and DevTools shows whether the browser rewrote your method on the way. For this code specifically, check whether the most common trigger applies to your situation: a login flow redirects to an identity provider and back. Compare your exchange against the raw HTTP example above. If you operate the server, correlate the timestamp with application and proxy logs using the request id; if you are the client, verify the request shape against the API documentation before changing anything or retrying.

Notes & gotchas

302 is not cached by default, which makes it safe for short-lived routing decisions; adding explicit freshness headers turns it into a cacheable redirect, so do that deliberately.

Examples

Raw HTTP
HTTP/1.1 302 Found
Location: https://example.com/login

curl
curl -i https://api.example.com/v1/resource   # observe the 302 response and its headers
JavaScript (fetch)
const res = await fetch("https://api.example.com/v1/resource");
// 302 Found: fetch follows redirects automatically.
// Use redirect: "manual" only when you must inspect Location yourself;
// browsers rewrite POST->GET on 301/302 but preserve it on 307/308.
Python (requests)
import requests

res = requests.get("https://api.example.com/v1/resource", timeout=10)
# 302 Found: requests follows redirects by default.
# allow_redirects=False to inspect Location; note requests preserves
# the method on 307/308 but rewrites POST->GET on 301/302 like browsers.

Frequently asked questions

302 vs 301: which should I use?

301 for permanent moves (SEO consolidation, URL updates); 302 for temporary ones (login, maintenance, campaigns). When in doubt, ask whether clients should remember the new URL.

Is 302 cached by browsers?

Not by default; it is only cacheable with explicit freshness headers. 301 is heuristically cacheable, which is another reason to choose carefully.

Which redirect code should I use?

Permanent move: 301 (GET) or 308 (method-preserving). Temporary: 302 (GET) or 307 (method-preserving). After a POST that should not repeat on refresh: 303. Cache revalidation is 304, not a redirect.

Do redirects hurt SEO or performance?

Single-hop permanent redirects (301/308) pass link equity and are fine. Chains, loops and temporary redirects for permanent moves waste crawl budget, add latency and dilute signals.

Advertisement
Ad slot · ref-in-article

Try the JSON Validator

Check JSON syntax and locate errors by line and column.

Open tool →