rsnext/test/integration/getinitialprops/next.config.js
kaykdm 47cb4cf850
Fix aspath for getInitialProps (#20572)
Fixes: https://github.com/vercel/next.js/issues/20370

> AsPath is incorrect on Server if you use rewrites and getInitialProps. On the server, asPath is the rewritten asPath while on the client asPath ist as given in the request URL.

The same issue was used to happen on `getServersideProps`, but it was fixed in this PR (https://github.com/vercel/next.js/pull/17121).
`getInitialProps` needs same fix except when the target is serverless, which has correct `asPath` value.

Additional tests have been added in the `getInitialProps` suite to ensure correct asPath with rewrites.
2021-01-25 18:26:32 +00:00

11 lines
169 B
JavaScript

module.exports = {
// replace me
async rewrites() {
return [
{
source: '/blog/post/:pid',
destination: '/blog/:pid',
},
]
},
}