efd8d22654
for internal: https://vercel.slack.com/archives/C03S8ED1DKM/p1691700057242999 ### Problem - The existing [`redirect()` function](https://nextjs.org/docs/app/api-reference/functions/redirect) can't control the status code. - The existing [`redirect()` function](https://nextjs.org/docs/app/api-reference/functions/redirect) returns a 307 HTTP redirect response while it returns a 308-equivalent meta tag `<meta http-equiv="refresh" content="0;url=/foo"/>` in streaming response (e.g., suspense boundary), making the behavior inconsistent. ### Solution Adding a new `permanentRedirect()` function and changing the meta tag default accordingly. | func | HTTP status | meta tag | |---|:---:|---| | `redirect()` | 307 | `<meta http-equiv="refresh" content="1;url=/foo"/>` | | `permanentRedirect()` | 308 | `<meta http-equiv="refresh" content="0;url=/foo"/>` | ref. https://developers.google.com/search/docs/crawling-indexing/301-redirects --------- Co-authored-by: JJ Kasper <jj@jjsweb.site> Co-authored-by: Tim Neutkens <tim@timneutkens.nl> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> |
||
---|---|---|
.. | ||
app | ||
pages | ||
middleware.js | ||
navigation.test.ts | ||
next.config.js |