rsnext/test/integration/custom-routes/next.config.js
Tim Neutkens 6a2c16a945
Update router to have only one route traverse pass (#9435)
* Fix next-news inconsistent return type

* Add failing test for static file rewrite

* Revert "Fix next-news inconsistent return type"

This reverts commit b66e76fb86061e45741c3c4bb9296a0874900f76.

* Add failing test for double redirect

* Fix bug in matcher when having multiple redirects

* Remove custom traversal in favor of router handling it

* Update next-server.ts

* Update router.ts

* Temporarily disable test

* Don't deeply resolve redirects

* Support combined parameters + query passing

* Make sure params are correctly passed in

* Add test for hash in route
2019-11-17 16:12:48 -08:00

98 lines
2.2 KiB
JavaScript

module.exports = {
// target: 'serverless',
experimental: {
async rewrites() {
return [
{
source: '/hello-world',
destination: '/static/hello.txt',
},
{
source: '/',
destination: '/another',
},
{
source: '/another',
destination: '/multi-rewrites',
},
{
source: '/first',
destination: '/hello',
},
{
source: '/second',
destination: '/hello-again',
},
{
source: '/test/:path',
destination: '/:path',
},
{
source: '/test-overwrite/:something/:another',
destination: '/params/this-should-be-the-value',
},
{
source: '/params/:something',
destination: '/with-params',
},
]
},
async redirects() {
return [
{
source: '/docs/router-status/:code',
destination: '/docs/v2/network/status-codes#:code',
statusCode: 301,
},
{
source: '/docs/github',
destination: '/docs/v2/advanced/now-for-github',
statusCode: 301,
},
{
source: '/docs/v2/advanced/:all(.*)',
destination: '/docs/v2/more/:all',
statusCode: 301,
},
{
source: '/hello/:id/another',
destination: '/blog/:id',
},
{
source: '/redirect1',
destination: '/',
},
{
source: '/redirect2',
destination: '/',
statusCode: 301,
},
{
source: '/redirect3',
destination: '/another',
statusCode: 302,
},
{
source: '/redirect4',
destination: '/',
statusCode: 308,
},
{
source: '/redir-chain1',
destination: '/redir-chain2',
statusCode: 301,
},
{
source: '/redir-chain2',
destination: '/redir-chain3',
statusCode: 302,
},
{
source: '/redir-chain3',
destination: '/',
statusCode: 303,
},
]
},
},
}