MockFoxAdvertise

HTTP 302 Found (Moved Temporarily)

Updated Free mock REST & WebSocket APIs

HTTP 302 Found — The resource is temporarily at a different URL, given in the Location header.

Class
3xx Redirection
Defined in
RFC 9110 §15.4.3
Official
Yes (IANA registry)
Cacheable by default
No (unless Cache-Control/Expires say so)

Try it: get a real 302 response

Our test endpoint answers every request with 302 Found.

curl -i https://mockfox.dev/api/status/302

Use it in tests, health-check monitors or to see how your client handles a 302. Add ?delay=2000 to slow it down.

What does HTTP 302 mean?

302 Found is a temporary redirect: the resource is currently at the URL in the Location header, but the client should keep using the original URL for future requests. Search engines keep the original URL indexed.

HTTP/1.0 called it "Moved Temporarily". Although the spec intended the method to be kept, browsers have always switched POST to GET when following a 302 — which is why 303 (always GET) and 307 (never change the method) were introduced.

When is 302 used?

  • Sending users to a login page and back (/dashboard → /login?next=/dashboard).
  • Geo or language redirects to a localised page.
  • A/B tests, maintenance pages and temporary promotions.
  • OAuth flows redirecting to the identity provider and back.

Why you're seeing 302

  • The application chose to send you elsewhere for now — very often because you're not logged in.
  • A login redirect loop usually means the session cookie isn't being saved (wrong cookie domain, Secure cookie on HTTP, SameSite blocking it).

What to do about 302

If you're visiting the site

  1. Your browser follows it automatically. If a page keeps bouncing you to the login screen, allow cookies for the site, clear its cookies, and sign in again.

If you run the site or API (developers)

  1. Use 301/308 if the move is permanent — a long-lived 302 can leave the old URL in search results.
  2. Use 303 after a successful form POST (Post/Redirect/Get) and 307 when the method and body must be preserved.
  3. Validate redirect targets (next= parameters) against an allow-list to prevent open-redirect vulnerabilities.

Sending 302: server examples

nginx

location /promo {
    return 302 /black-friday;
}

Express

app.get("/dashboard", (req, res) => {
  if (!req.session.user) return res.redirect("/login?next=/dashboard"); // 302 by default
  res.render("dashboard");
});

Next.js

// Next.js redirect() sends 307 (303 inside Server Actions).
// For a literal 302 in a route handler:
export function GET() {
  return Response.redirect(new URL("/login", "https://example.com"), 302);
}

Example 302 response

HTTP/1.1 302 Found
Location: /login?next=%2Fdashboard
Cache-Control: no-cache
Content-Length: 0

Related status codes

Related tools

Frequently asked questions

What's the difference between 301 and 302?

301 is permanent: browsers cache it and search engines move rankings to the new URL. 302 is temporary: the original URL stays canonical and isn't replaced in search results.

302 or 307?

Both are temporary. With 307 the client must resend the same method and body; with 302 browsers turn POST into GET. Use 307 for APIs, 302 (or 303) for typical page redirects.

Does Google follow 302 redirects?

Yes, it follows them and may eventually treat a long-standing 302 like a 301, but it's better to use the status that matches your intent.