HTTP redirects
Also called: HTTP redirection, Location redirect
An HTTP redirect asks the client to make another request, usually to the address in Location. Status codes communicate whether the move is temporary or permanent and how the method is handled. A 307 or 308 preserves the method and body; 303 points to a retrieval request. Historical 301 and 302 behavior can change POST to GET.
For example, after accepting a submitted form, a server can return 303 pointing to a receipt that the browser fetches with GET. A permanent move of an API operation may use 308 when preserving the method matters. Redirects add requests and can form loops; not every 3xx response redirects to another address.
- Read first
- HTTP
- Related
- HTTP methods, HTTP status codes, Web proxy
- Further reading
- MDN — Redirections in HTTP