Qaynaq LABS · TOOLS

HTTP · 3xx Redirection

302 Found

Resource temporarily moved to a different URI, client should use original URI next time.

When you see this status

  • User logs in and is redirected to dashboard
  • Website temporarily moved to a new domain
  • API endpoint relocated for maintenance

Common causes

  • Temporary URL changes for A/B testing
  • Maintenance pages or site migrations
  • Authentication redirects after login

How to debug it

  1. Verify Location header contains correct URI
  2. Check if client follows redirects automatically
  3. Inspect browser/network tab for redirect chain
  4. Ensure cache headers don't prevent redirection

Return this code in your framework

Express (Node.js)
res.redirect(302, 'https://example.com/new-location');
FastAPI (Python)
from fastapi import Response
return Response(status_code=302, headers={"Location": "https://example.com/new-location"})
NestJS
@Get()
@Redirect('https://example.com/new-location', 302)
getRedirect() { return null; }
Go (net/http)
http.Redirect(w, r, "https://example.com/new-location", http.StatusFound)

About HTTP 302

HTTP status code 302 Found is part of the 3xx Redirection family. Resource temporarily moved to a different URI, client should use original URI next time. Understanding it is essential for backend engineers, API designers, and anyone debugging integrations between services.

The Qaynaq Labs HTTP Status Code Explainer covers all standard codes with practical guidance: what triggers them, how to debug them in production, and exactly how to return them from common frameworks. Each code page is hand-curated and verified.

Frequently asked

Should I use 302 or 301 for temporary redirects?

Use 302 for temporary redirects to avoid SEO penalties. 301 indicates permanent change to search engines.

Why does my browser cache a 302 redirect?

Browsers may cache 302 redirects based on Cache-Control headers. Use 'no-store' to prevent caching.

Can I include a response body with a 302?

Technically yes, but clients typically ignore it. Best practice is to send empty body with Location header.