Found
Tells the client to look at (browse to) another URL temporarily.
What it means
The HTTP 302 Found redirect status response code indicates that the resource requested has been temporarily moved to the URL given by the `Location` header.
Historically, many browsers implemented this poorly and would change the HTTP method to GET for the subsequent request, regardless of the original method. For predictable behavior, 303 or 307 are preferred in modern APIs.
How it works
- 1The client requests a resource.
- 2The server responds with '302 Found' and a 'Location' header.
- 3The client makes a new request to the provided location.
- 4Unlike 301, the client does not cache this redirect permanently.
Why you're seeing this
- • A temporary routing rule or authentication guard triggered.
How to fix it
- • If a POST request turns into a GET request after a 302 redirect, use a 307 Temporary Redirect instead to force the browser to maintain the POST method.
Framework Implementations
Express.js
app.get('/dashboard', (req, res) => {
if (!req.user) return res.redirect(302, '/login');
res.send('Dashboard');
});Real-Life Scenarios
Use this for temporary URL changes, like redirecting a user to a login page if they are not authenticated, or during a temporary A/B test.
Authentication Redirects
A user tries to access /dashboard. The server sees they aren't logged in and returns a 302 to /login.
Geofencing / Localization
A user visits site.com and is temporarily redirected to site.com/en-us based on their IP address.
HTTP Transaction
1. Client Request
GET /dashboard HTTP/1.1 Host: app.com
2. Server Response
HTTP/1.1 302 Found Location: /login?returnTo=/dashboard
SEO Implications
Search engines do NOT pass link equity to the new URL because they assume the original URL will eventually return. Do not use 302 for permanent URL changes.