Only 307 and 308 always keep the request method and body. 303 always switches to GET. 301 and 302 may turn a POST into a GET.
301 Moved Permanently and 302 Found are the original redirects. Permanent means clients and search engines should update their links to the new URL. A 301 is cacheable by default. For historical reasons, user agents (browsers and other HTTP clients) may change a POST into a GET when they follow either one.
303 See Other always tells the client to fetch the new URL with GET. It is the base of the Post/Redirect/Get pattern:
- The user submits a form with POST.
- The server answers with a 303 redirect to a result page.
- The browser loads the result page with GET, so a page refresh does not send the form again.
307 Temporary Redirect and 308 Permanent Redirect were added later to remove the confusion. With them, the client must repeat the request with the same method and the same body. Use 308 when you move an API endpoint that receives POST or PUT for good. Use 307 for temporary moves.
- 301 and 308 are permanent. 302 and 307 are temporary.
- 301 and 302 may turn a POST into a GET.
- 303 always switches to GET. This is the Post/Redirect/Get pattern.
- 307 and 308 keep the request method and body.