303 See Other instructs the client to fetch the response from a different URL using GET. Even if the original request was a POST, the redirected request is specified to become a GET.
This makes it the standard tool for the Post/Redirect/Get (PRG) pattern: after a form submission you redirect to a result page, so refreshing does not resubmit the POST and you avoid duplicate orders or sign-ups.
POST /orders HTTP/1.1
Host: shop.example.com
Content-Type: application/x-www-form-urlencoded
item=book&qty=1HTTP/1.1 303 See Other
Location: /orders/5821
Content-Length: 0app.post('/orders', (req, res) => {
const id = createOrder(req.body);
res.redirect(303, `/orders/${id}`); // browser does GET /orders/:id
});@app.post('/orders')
def create_order():
oid = create(request.form)
return redirect(f'/orders/{oid}', code=303)