Example HTTP Response
HTTP/1.1 302 Found
Location: /temporary-page- Temporary maintenance redirect
- A/B testing redirects
- Temporary URL changes
What does this mean?
Detour ahead! The page is temporarily hanging out somewhere else. We'll point you there!
Technical Definition
The URI of the requested resource has been changed temporarily.
RFC Says
"The 302 (Found) status code indicates that the target resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client ought to continue to use the effective request URI for future requests."
Plain English:
The resource has temporarily moved to a different URL. Keep using the original URL for future requests since this redirect might change. The redirect is not permanent.
"Note: For historical reasons, a user agent MAY change the request method from POST to GET for the subsequent request."
Plain English:
Due to old browser behavior, a POST request might become a GET request after following a 302 redirect. If you need to preserve the HTTP method, use 307 (Temporary Redirect) instead.
Common Misinterpretation
Many developers don't realize 302 can change POST to GET, just like 301. For modern applications, prefer 307 for temporary redirects when method preservation matters (APIs, form submissions). Use 303 when you explicitly want POST to become GET (redirect-after-POST pattern).
Ready-to-use code for returning this HTTP status in your application:
// Express.js
app.get('/example', (req, res) => {
res.status(302).json({
error: 'Found',
message: 'Your error message here'
});
});
// Native HTTP
const http = require('http');
http.createServer((req, res) => {
res.writeHead(302, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({
error: 'Found',
message: 'Your error message here'
}));
}).listen(3000);- Legacy compatibility - prefer 307 for temporary redirects in new code
- The redirect is temporary and the original URL should continue to be used
- Warning: Historically changed POST to GET; behavior varies by client