HTTP 303 vs. 307 After POST: Which Redirect Resends Form Data?
Submit the same form through two redirects with the same Location. Inspect the next request in your browser to see which one still carries the form data.

A print shop takes an order for two pages. After you press Print, the browser follows a redirect. Did it ask to see the receipt, or did it send the print order to a different queue? Both redirects can carry the same Location header. The difference is in the second request.
Decide what the destination should receive
If the shop has already accepted the order, it can reply with 303 See Other and the URL of a receipt. When a browser follows that response to a form POST, it requests the receipt with GET, without the form body. Reloading the resulting receipt page fetches it again; it doesn't submit the form again. That won't prevent two clicks on the original Print button, though. Those are two separate submissions.
If the original handler has not accepted the order and the job belongs in another queue, it can use 307 Temporary Redirect. A browser following the redirect sends POST to the new URL with the same form data. The receiving handler needs to accept that POST. Pointing a 307 at a GET-only receipt page is a good way to end up with 405 Method Not Allowed instead of a receipt.
/arrived in both cases. It can't tell you which request got you there.Watch both requests on localhost
Save this as redirect-demo.mjs and run node redirect-demo.mjs. Open the loopback URL it prints. The two buttons submit the same field, pages=2. Both handlers point to /arrived, which just echoes what it received. Nothing is printed, stored, or sent to a print service.
import { createServer } from "node:http";
const server = createServer(async (req, res) => {
if (req.method === "GET" && req.url === "/") {
res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
return res.end(`<form method="post">
<input type="hidden" name="pages" value="2">
<button formaction="/303">Try 303</button>
<button formaction="/307">Try 307</button>
</form>`);
}
if (req.method === "POST" && ["/303", "/307"].includes(req.url)) {
req.resume();
return res.writeHead(Number(req.url.slice(1)), { Location: "/arrived" }).end();
}
if (req.url !== "/arrived") return res.writeHead(404).end();
let body = "";
for await (const chunk of req) body += chunk;
res.writeHead(200, { "Content-Type": "text/plain; charset=utf-8" });
res.end(`${req.method} /arrived | ${body || "(no body)"}`);
});
server.listen(0, "127.0.0.1", () => {
process.stdout.write(`http://127.0.0.1:${server.address().port}\n`);
});
Open the Network panel and enable Preserve log before clicking Try 303. Inspect the response to /303 for the status and Location, then inspect the request to /arrived for its method. The page itself reads GET /arrived | (no body). Go back to the form and click Try 307. This time the page reads POST /arrived | pages=2. Stop the local server with Ctrl+C when you're done.
Diagnose the first hop, not just the final status
The demo finishes with 200 OK both times. If a form behaves differently after a route change, the final status alone won't explain it. Look at what the first handler returned and what the next handler actually received. Use the HTTP Status Codes reference to look up 303 and 307 separately; expand each entry and compare the method in its description. For the underlying rules, see See Other and Temporary Redirect in RFC 9110.