Unverified Commit de567d91 authored by JJ Kasper's avatar JJ Kasper Committed by GitHub

Update incremental migration doc and add version for new rewrites (#23859)

This updates the incremental migration doc to mention the new fallback rewrites over the previous no-op rewrite behavior. This also mentions the version the new rewrites modes were added to the rewrites doc.  

## Documentation / Examples

- [x] Make sure the linting passes
parent 1258d13d
......@@ -40,7 +40,7 @@ module.exports = {
- `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.
Rewrites are applied after checking the filesystem (pages and `/public` files) and before dynamic routes by default. This behavior can be changed by instead returning an object instead of an array from the `rewrites` function:
Rewrites are applied after checking the filesystem (pages and `/public` files) and before dynamic routes by default. This behavior can be changed by instead returning an object instead of an array from the `rewrites` function since `v10.1` of Next.js:
```js
module.exports = {
......
......@@ -46,6 +46,18 @@ For example, let's say you created a Next.js app to be served from `example.com`
module.exports = {
async rewrites() {
return {
// After checking all Next.js pages (including dynamic routes)
// and static files we proxy any other requests
fallback: [
{
source: '/:path*',
destination: `https://proxy.example.com/:path*`,
},
],
}
// For versions of Next.js < v10.1 you can use a no-op rewrite instead
return [
// we need to define a no-op rewrite to trigger checking
// all pages/static files before we attempt proxying
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment