Status codes · 1xx–5xx
3xx: redirects and 304 validation
Choosing 301/302/303/307/308 changes methods and user flows.
Understand the concept
301 is permanent and 302 is temporary. Historical client behaviour permits a POST to become GET with these responses. 307 and 308 preserve the method and body, with temporary and permanent meanings respectively. After processing a submitted form, 303 can direct the browser to retrieve a result with GET. That helps avoid accidental resubmission, but does not replace idempotency for sensitive operations.
304 is cache validation, not navigation. A conditional GET or HEAD can reuse an existing representation without receiving content again. The response is bodyless and still carries relevant validation metadata. Treating every 3xx response as a new page is therefore incorrect.
Redirect chains add latency and loops prevent completion. Credentials may not travel to a different origin. Validate application redirect targets, consider the caching consequences of permanent redirects, and distinguish current codes from deprecated or unused entries.
For form submissions, URL migrations and cache validation.
Redirecting an API POST with 302 and assuming the body is preserved.
One topic. Three levels of depth.
HTTP/1.1 303 See Other
Location: /orders/42Retrieve the form result with GET.
This page does not send requests to external servers. Messages are readable HTTP/1.1 illustrations, not HTTP/2 or HTTP/3 wire dumps. example.test is reserved for examples. Run commands and JavaScript only in your own test environment; never publish real tokens or cookies.
Try it yourself first.
A POST must permanently move to a new endpoint while preserving its method. Which code?
Show the solution and explanation
HTTP/1.1 308 Permanent Redirect
Location: /api/v2/orders308 is a permanent redirect that preserves method and body.