2019-11-09 23:34:53 +01:00
|
|
|
module.exports = {
|
2019-11-10 05:00:54 +01:00
|
|
|
// target: 'serverless',
|
2019-11-09 23:34:53 +01:00
|
|
|
experimental: {
|
2019-11-11 04:24:53 +01:00
|
|
|
async rewrites() {
|
2019-11-09 23:34:53 +01:00
|
|
|
return [
|
2019-12-30 20:06:38 +01:00
|
|
|
{
|
|
|
|
source: '/to-another',
|
|
|
|
destination: '/another/one',
|
|
|
|
},
|
2020-02-11 00:06:38 +01:00
|
|
|
{
|
|
|
|
source: '/nav',
|
|
|
|
destination: '/404',
|
|
|
|
},
|
2019-11-18 01:12:48 +01:00
|
|
|
{
|
|
|
|
source: '/hello-world',
|
|
|
|
destination: '/static/hello.txt',
|
|
|
|
},
|
2019-11-09 23:34:53 +01:00
|
|
|
{
|
|
|
|
source: '/',
|
2019-11-11 04:24:53 +01:00
|
|
|
destination: '/another',
|
2019-11-09 23:34:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
source: '/another',
|
2019-11-11 04:24:53 +01:00
|
|
|
destination: '/multi-rewrites',
|
2019-11-09 23:34:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
source: '/first',
|
2019-11-11 04:24:53 +01:00
|
|
|
destination: '/hello',
|
2019-11-09 23:34:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
source: '/second',
|
2019-11-11 04:24:53 +01:00
|
|
|
destination: '/hello-again',
|
2019-11-09 23:34:53 +01:00
|
|
|
},
|
2019-12-23 22:20:17 +01:00
|
|
|
{
|
|
|
|
source: '/to-hello',
|
|
|
|
destination: '/hello',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
source: '/blog/post-1',
|
|
|
|
destination: '/blog/post-2',
|
|
|
|
},
|
2019-11-09 23:34:53 +01:00
|
|
|
{
|
|
|
|
source: '/test/:path',
|
2019-11-11 04:24:53 +01:00
|
|
|
destination: '/:path',
|
2019-11-09 23:34:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
source: '/test-overwrite/:something/:another',
|
2019-11-11 04:24:53 +01:00
|
|
|
destination: '/params/this-should-be-the-value',
|
2019-11-09 23:34:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
source: '/params/:something',
|
2019-11-11 04:24:53 +01:00
|
|
|
destination: '/with-params',
|
|
|
|
},
|
2019-12-31 21:13:55 +01:00
|
|
|
{
|
|
|
|
source: '/query-rewrite/:section/:name',
|
|
|
|
destination: '/with-params?first=:section&second=:name',
|
|
|
|
},
|
2019-12-23 22:20:17 +01:00
|
|
|
{
|
|
|
|
source: '/hidden/_next/:path*',
|
|
|
|
destination: '/_next/:path*',
|
|
|
|
},
|
2020-02-04 20:08:03 +01:00
|
|
|
{
|
|
|
|
source: '/proxy-me/:path*',
|
|
|
|
destination: 'http://localhost:__EXTERNAL_PORT__/:path*',
|
|
|
|
},
|
2020-01-23 10:23:34 +01:00
|
|
|
{
|
|
|
|
source: '/api-hello',
|
|
|
|
destination: '/api/hello',
|
|
|
|
},
|
|
|
|
{
|
2020-03-10 21:09:35 +01:00
|
|
|
source: '/api-hello-regex/:first(.*)',
|
|
|
|
destination: '/api/hello?name=:first*',
|
2020-01-23 10:23:34 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
source: '/api-hello-param/:name',
|
2020-02-26 19:14:34 +01:00
|
|
|
destination: '/api/hello?hello=:name',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
source: '/api-dynamic-param/:name',
|
|
|
|
destination: '/api/dynamic/:name?hello=:name',
|
2020-01-23 10:23:34 +01:00
|
|
|
},
|
2020-02-11 00:06:38 +01:00
|
|
|
{
|
|
|
|
source: '/:path/post-321',
|
|
|
|
destination: '/with-params',
|
|
|
|
},
|
2020-03-10 21:09:35 +01:00
|
|
|
{
|
|
|
|
source: '/unnamed-params/nested/(.*)/:test/(.*)',
|
|
|
|
destination: '/with-params',
|
|
|
|
},
|
2019-11-09 23:34:53 +01:00
|
|
|
]
|
|
|
|
},
|
2019-11-11 04:24:53 +01:00
|
|
|
async redirects() {
|
2019-11-09 23:34:53 +01:00
|
|
|
return [
|
2020-02-14 16:53:08 +01:00
|
|
|
{
|
|
|
|
source: '/redirect/me/to-about/:lang',
|
|
|
|
destination: '/:lang/about',
|
|
|
|
permanent: false,
|
|
|
|
},
|
2019-11-18 01:12:48 +01:00
|
|
|
{
|
|
|
|
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,
|
|
|
|
},
|
2019-11-09 23:34:53 +01:00
|
|
|
{
|
|
|
|
source: '/hello/:id/another',
|
2019-11-11 04:24:53 +01:00
|
|
|
destination: '/blog/:id',
|
2020-01-14 19:28:48 +01:00
|
|
|
permanent: false,
|
2019-11-09 23:34:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
source: '/redirect1',
|
2019-11-11 04:24:53 +01:00
|
|
|
destination: '/',
|
2020-01-14 19:28:48 +01:00
|
|
|
permanent: false,
|
2019-11-09 23:34:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
source: '/redirect2',
|
|
|
|
destination: '/',
|
2019-11-11 04:24:53 +01:00
|
|
|
statusCode: 301,
|
2019-11-09 23:34:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
source: '/redirect3',
|
|
|
|
destination: '/another',
|
2019-11-11 04:24:53 +01:00
|
|
|
statusCode: 302,
|
2019-11-09 23:34:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
source: '/redirect4',
|
|
|
|
destination: '/',
|
2020-01-14 19:28:48 +01:00
|
|
|
permanent: true,
|
2019-11-09 23:34:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
source: '/redir-chain1',
|
|
|
|
destination: '/redir-chain2',
|
2019-11-11 04:24:53 +01:00
|
|
|
statusCode: 301,
|
2019-11-09 23:34:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
source: '/redir-chain2',
|
|
|
|
destination: '/redir-chain3',
|
2019-11-11 04:24:53 +01:00
|
|
|
statusCode: 302,
|
2019-11-09 23:34:53 +01:00
|
|
|
},
|
|
|
|
{
|
|
|
|
source: '/redir-chain3',
|
|
|
|
destination: '/',
|
2019-11-11 04:24:53 +01:00
|
|
|
statusCode: 303,
|
|
|
|
},
|
2019-12-17 18:02:39 +01:00
|
|
|
{
|
|
|
|
source: '/to-external',
|
|
|
|
destination: 'https://google.com',
|
2020-01-14 19:28:48 +01:00
|
|
|
permanent: false,
|
2019-12-17 18:02:39 +01:00
|
|
|
},
|
2019-12-31 21:13:55 +01:00
|
|
|
{
|
|
|
|
source: '/query-redirect/:section/:name',
|
|
|
|
destination: '/with-params?first=:section&second=:name',
|
2020-01-14 19:28:48 +01:00
|
|
|
permanent: false,
|
2019-12-31 21:13:55 +01:00
|
|
|
},
|
2020-01-16 23:38:38 +01:00
|
|
|
{
|
|
|
|
source: '/unnamed/(first|second)/(.*)',
|
2020-03-10 21:09:35 +01:00
|
|
|
destination: '/got-unnamed',
|
2020-01-16 23:38:38 +01:00
|
|
|
permanent: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
source: '/named-like-unnamed/:0',
|
|
|
|
destination: '/:0',
|
|
|
|
permanent: false,
|
|
|
|
},
|
2020-02-11 00:06:38 +01:00
|
|
|
{
|
|
|
|
source: '/redirect-override',
|
|
|
|
destination: '/thank-you-next',
|
|
|
|
permanent: false,
|
|
|
|
},
|
2020-03-10 21:09:35 +01:00
|
|
|
{
|
|
|
|
source: '/docs/:first(integrations|now-cli)/v2:second(.*)',
|
|
|
|
destination: '/:first/:second',
|
|
|
|
permanent: false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
source: '/catchall-redirect/:path*',
|
|
|
|
destination: '/somewhere',
|
|
|
|
permanent: false,
|
|
|
|
},
|
2019-11-09 23:34:53 +01:00
|
|
|
]
|
2019-11-11 04:24:53 +01:00
|
|
|
},
|
2020-01-01 13:47:58 +01:00
|
|
|
|
|
|
|
async headers() {
|
|
|
|
return [
|
|
|
|
{
|
|
|
|
source: '/add-header',
|
|
|
|
headers: [
|
|
|
|
{
|
|
|
|
key: 'x-custom-header',
|
|
|
|
value: 'hello world',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'x-another-header',
|
|
|
|
value: 'hello again',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
source: '/my-headers/(.*)',
|
|
|
|
headers: [
|
|
|
|
{
|
|
|
|
key: 'x-first-header',
|
|
|
|
value: 'first',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
key: 'x-second-header',
|
|
|
|
value: 'second',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2020-02-11 00:06:38 +01:00
|
|
|
{
|
|
|
|
source: '/:path*',
|
|
|
|
headers: [
|
|
|
|
{
|
|
|
|
key: 'x-something',
|
|
|
|
value: 'applied-everywhere',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2020-01-01 13:47:58 +01:00
|
|
|
]
|
|
|
|
},
|
2019-11-11 04:24:53 +01:00
|
|
|
},
|
2019-11-09 23:34:53 +01:00
|
|
|
}
|