302 HTTP Origin: Network Last updated 9 Oct 2026

HTTP 302 Found (Temporary Redirect)

The resource is temporarily at another URL; clients should keep using the original URL for future requests.

Exact message you may see moved temporarilytemporary redirect307 Temporary Redirect308 Permanent Redirect

Meaning

302 tells clients “go there for now”. Login redirects, A/B tests and maintenance pages use it. SEO trouble comes from using 302 for permanent moves (ranking may not transfer), and API trouble comes from clients following 302 with a GET even when the original request was a POST. 307 is the method-preserving temporary redirect.

Common causes

  • Session expired — app redirects to the login page (APIs then receive HTML instead of JSON)
  • Permanent move implemented as 302 by mistake (framework default redirect())
  • POST-redirect-GET pattern after form submission (intended)
  • Geo/language redirects

⚡ Quick fix

  1. For permanent moves use 301/308
  2. For APIs, return 401 JSON instead of redirecting to a login page
  3. Use 307 when the method and body must be preserved

Detailed fix by platform

PHP

  1. header('Location: /new', true, 301); — PHP sends 302 by default when you only set Location.

Node.js

  1. Express res.redirect('/new') is 302; use res.redirect(301, '/new') for permanent moves.

JavaScript

  1. fetch() follows redirects silently — check res.redirected and res.url to detect a login redirect.

Code examples

Detect a login redirect in fetch

javascript
const res = await fetch('/api/orders');
if (res.redirected && res.url.includes('/login')) {
  location.href = '/login?next=' + encodeURIComponent(location.pathname);
}

How to diagnose

  1. Intent — Is the move temporary or permanent?
  2. Target — Where does Location point?
  3. Method — Does the client re-send POST data correctly?
  4. API — Is an API getting an HTML login page via 302?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Network. Errors that are often confused with or caused by this one (click to open):

301 — HTTP 301 Moved Permanently (HTTP)301303 — HTTP 303 See Other (HTTP)303307 — HTTP 307 Temporary Redirect (HTTP)307308 — HTTP 308 Permanent Redirect (HTTP)308401 — HTTP 401 Unauthorized (HTTP)401451 — HTTP 451 Unavailable For Legal Reasons (HTTP)451ERR_TOO_MANY_REDIRECTS — Chrome: This page isn’t working — example.com redirected you too many times. ERR_TOO_MANY_REDIRECTS (Browser)ERR_TOO_MANY_REDIRECTSERR_TOO_MANY_REDIRECTS (Cloudflare) — ERR_TOO_MANY_REDIRECTS with Cloudflare (Flexible SSL redirect loop) (Cloudflare)ERR_TOO_MANY_REDIRECT…302

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.