diff --git a/docs/api-reference/next.config.js/redirects.md b/docs/api-reference/next.config.js/redirects.md index 30f7ac88c6805..bc3c2fd919dcb 100644 --- a/docs/api-reference/next.config.js/redirects.md +++ b/docs/api-reference/next.config.js/redirects.md @@ -44,6 +44,9 @@ module.exports = { - `source` is the incoming request path pattern. - `destination` is the path you want to route to. - `permanent` `true` or `false` - if `true` will use the 308 status code which instructs clients/search engines to cache the redirect forever, if `false` will use the 307 status code which is temporary and is not cached. + +> **Why does Next.js use 307 and 308?** Traditionally a 302 was used for a temporary redirect, and a 301 for a permanent redirect, but many browsers changed the request method of the redirect to `GET`, regardless of the original method. For example, if the browser made a request to `POST /v1/users` which returned status code `302` with location `/v2/users`, the subsequent request might be `GET /v2/users` instead of the expected `POST /v2/users`. Next.js uses the 307 temporary redirect, and 308 permanent redirect status codes to explicitly preserve the request method used. + - `basePath`: `false` or `undefined` - if false the basePath won't be included when matching, can be used for external rewrites only. - `locale`: `false` or `undefined` - whether the locale should not be included when matching. - `has` is an array of [has objects](#header-cookie-and-query-matching) with the `type`, `key` and `value` properties. diff --git a/docs/basic-features/data-fetching/get-server-side-props.md b/docs/basic-features/data-fetching/get-server-side-props.md index da0463f1fecd5..b09a70d0e8a87 100644 --- a/docs/basic-features/data-fetching/get-server-side-props.md +++ b/docs/basic-features/data-fetching/get-server-side-props.md @@ -21,7 +21,7 @@ export async function getServerSideProps(context) { - When you request this page directly, `getServerSideProps` runs at request time, and this page will be pre-rendered with the returned props - When you request this page on client-side page transitions through [`next/link`](/docs/api-reference/next/link.md) or [`next/router`](/docs/api-reference/next/router.md), Next.js sends an API request to the server, which runs `getServerSideProps` -It then returns `JSON` that contains the result of running `getServerSideProps`, that `JSON` will be used to render the page. All this work will be handled automatically by Next.js, so you don’t need to do anything extra as long as you have `getServerSideProps` defined. +`getServerSideProps` returns JSON which will be used to render the page. All this work will be handled automatically by Next.js, so you don’t need to do anything extra as long as you have `getServerSideProps` defined. You can use the [next-code-elimination tool](https://next-code-elimination.vercel.app/) to verify what Next.js eliminates from the client-side bundle. diff --git a/docs/basic-features/script.md b/docs/basic-features/script.md index 70839f6a457bd..b08be05800e08 100644 --- a/docs/basic-features/script.md +++ b/docs/basic-features/script.md @@ -25,7 +25,7 @@ description: Next.js helps you optimize loading third-party scripts with the bui -The Next.js Script component, [`next/script`](/docs/api-reference/next/script.md), is an extension of the HTML `