No description
Find a file
Shohei Maeda efd8d22654
Add new permanentRedirect function in App Router (#54047)
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>
2023-08-28 14:22:43 -07:00
.cargo Update rust toolchain (#54130) 2023-08-17 16:37:33 +00:00
.config Update Next.js code owners (#51319) 2023-06-14 20:07:32 -07:00
.devcontainer re-enable next-dev-tests (#47087) 2023-03-14 16:05:19 +01:00
.github Implement granular rust caching (#54582) 2023-08-26 18:54:14 -07:00
.husky Replace pre-commit with husky (#38350) 2022-07-06 11:14:16 -05:00
.vscode Revert "Implement new forking technique for vendored packages. (#51083)" (#53640) 2023-08-06 13:00:12 -07:00
bench File Reader Improvements (#54645) 2023-08-28 18:09:56 +00:00
contributing Include instructions for bun package manager (#53590) 2023-08-10 23:44:20 +00:00
docs Add new permanentRedirect function in App Router (#54047) 2023-08-28 14:22:43 -07:00
errors docs: Rewrite Rendering Section and React Essentials Page (#51579) 2023-08-24 08:48:44 -05:00
examples updated sitecore deploy button (#54678) 2023-08-28 17:59:53 +00:00
packages Add new permanentRedirect function in App Router (#54047) 2023-08-28 14:22:43 -07:00
scripts Implement granular rust caching (#54582) 2023-08-26 18:54:14 -07:00
test Add new permanentRedirect function in App Router (#54047) 2023-08-28 14:22:43 -07:00
.alexignore Integrate next-* crates from Turbopack (#47019) 2023-03-13 14:33:17 +01:00
.alexrc docs: Add "special" to the Alex allowlist (#48021) 2023-04-06 16:32:06 +02:00
.eslintignore Optimize webpack memory cache garbage collection (#54397) 2023-08-23 15:46:32 +02:00
.eslintrc.json update eslint config (#53637) 2023-08-07 09:41:14 +00:00
.gitattributes chore: mark build folder indexable (#54029) 2023-08-14 22:17:34 +00:00
.gitignore Optimize webpack memory cache garbage collection (#54397) 2023-08-23 15:46:32 +02:00
.npmrc fix: npm publish provenance permissions (#48757) 2023-04-24 14:08:55 +00:00
.prettierignore chore: add GH action to notify about pending PRs (#53541) 2023-08-03 21:40:28 +00:00
.prettierignore_staged Revert "Implement new forking technique for vendored packages. (#51083)" (#53640) 2023-08-06 13:00:12 -07:00
.prettierrc.json Prettier trailingComma default value to es5 since 2.0 (#14391) 2020-06-22 13:25:24 +02:00
.rustfmt.toml build(cargo): move workspaces manifest to top level (#48198) 2023-04-19 18:38:36 +02:00
azure-pipelines.yml fix: minimum node version 16.14.0 (#54331) 2023-08-22 08:58:53 +00:00
Cargo.lock update turbopack (#54558) 2023-08-25 16:22:35 +02:00
Cargo.toml update turbopack (#54558) 2023-08-25 16:22:35 +02:00
CODE_OF_CONDUCT.md updated code of conduct to v2.1 (#34208) 2022-02-10 18:11:42 -06:00
contributing.md chore: improve repo templates (#46629) 2023-03-01 09:25:51 -08:00
jest.config.js test(ci): refine test suite name unique (#54013) 2023-08-14 19:58:56 +00:00
jest.replay.config.js Add Replay integration for dev e2e tests (#40955) 2022-09-29 14:45:10 -07:00
lerna.json v13.4.20-canary.11 2023-08-28 14:27:50 +00:00
license.md Update license year (#44403) 2023-01-01 11:12:49 +01:00
lint-staged.config.js Run dev tests against default CNA templates (#45211) 2023-01-24 11:01:03 -08:00
package.json upgrade Edge Runtime dependency (#54489) 2023-08-24 11:00:31 +00:00
plopfile.js Opt-in to dynamic rendering when reading searchParams (#46205) 2023-03-16 21:46:35 +01:00
pnpm-lock.yaml v13.4.20-canary.11 2023-08-28 14:27:50 +00:00
pnpm-workspace.yaml Optimize webpack memory cache garbage collection (#54397) 2023-08-23 15:46:32 +02:00
readme.md Monorepo (#5341) 2018-10-01 01:02:10 +02:00
release.js Fix labels for release sections 2021-11-21 13:11:54 +01:00
run-tests.js chore(ci): emit env vars that impact ci results (#54534) 2023-08-24 23:12:23 +00:00
rust-toolchain Update rust toolchain (#54130) 2023-08-17 16:37:33 +00:00
socket.yaml chore(ci): add socket.yaml (#54446) 2023-08-23 18:12:51 +00:00
test-file.txt Add additional file serving tests (#12479) 2020-05-04 11:58:19 -05:00
tsconfig-tsec.json Integrate tsec into the linting process (#33746) 2022-02-24 16:59:18 -08:00
tsconfig.json type check tests (and convert next-test-utils.js to ts) (#51071) 2023-06-23 17:42:50 +00:00
tsec-exemptions.json Move core files to src folder and move JS files to TypeScript (#44405) 2023-01-03 10:05:50 +01:00
turbo.json Implement granular rust caching (#54582) 2023-08-26 18:54:14 -07:00
UPGRADING.md (Fix)Broken upgrading.mdx link (#54234) 2023-08-18 17:10:38 +00:00
vercel.json Silence GH Comments for Preview URLs (#18766) 2020-11-03 21:59:47 +00:00

Next.js

Getting Started

Visit https://nextjs.org/learn to get started with Next.js.

Documentation

Visit https://nextjs.org/docs to view the full documentation.

Who is using Next.js?

Next.js is used by the world's leading companies. Check out the Next.js Showcase to learn more.

Community

The Next.js community can be found on GitHub Discussions, where you can ask questions, voice ideas, and share your projects.

To chat with other community members you can join the Next.js Discord.

Our Code of Conduct applies to all Next.js community channels.

Contributing

Please see our contributing.md.

Good First Issues

We have a list of good first issues that contain bugs that have a relatively limited scope. This is a great place to get started, gain experience, and get familiar with our contribution process.

Authors

Security

If you believe you have found a security vulnerability in Next.js, we encourage you to responsibly disclose this and not open a public issue. We will investigate all legitimate reports. Email security@vercel.com to disclose any security vulnerabilities.

https://vercel.com/security