Example HTTP Response
HTTP/1.1 303 See Other
Location: /confirmation-page- Redirect after form submission
- POST-redirect-GET pattern
- Preventing form resubmission on refresh
What does this mean?
Look over there! After doing what you asked, the result is waiting for you at a different address.
Technical Definition
The server sent this response to direct the client to get the requested resource at another URI with a GET request.
RFC Says
"The 303 (See Other) status code indicates that the server is redirecting the user agent to a different resource, as indicated by a URI in the Location header field, which is intended to provide an indirect response to the original request. A user agent can perform a retrieval request targeting that URI (a GET or HEAD request), which is the proper method for obtaining the resource."
Plain English:
The operation succeeded, now go fetch the result using a GET request at the Location URL. This is perfect for the POST-Redirect-GET pattern: after a form submission (POST), redirect to a confirmation page (GET) to prevent duplicate submissions on browser refresh.
Common Misinterpretation
303 explicitly changes the method to GET, unlike 302/307 where method preservation behavior is ambiguous. Use 303 when you want POST to become GET after redirect (form submissions), use 307 when you want POST to stay POST (API redirects).
Ready-to-use code for returning this HTTP status in your application:
// Express.js
app.get('/example', (req, res) => {
res.status(303).json({
error: 'See Other',
message: 'Your error message here'
});
});
// Native HTTP
const http = require('http');
http.createServer((req, res) => {
res.writeHead(303, { 'Content-Type': 'application/json' });
res.end(JSON.stringify({
error: 'See Other',
message: 'Your error message here'
}));
}).listen(3000);