Open yunsii opened 2 years ago
I am also encountering the issue !
Instead of being pure JSON, the next data file contains the HTML of the rewrited page. Tested on Next v12.2.2 and 12.2.3.
@Domino9697 any update on that?
workaround:
rewrites: {
// ...
afterFiles: [
{
source: `ssr1/:path*`,
has: [
{
type: 'host',
value: `dev.next-ssr1.com`,
},
],
destination: `/:path*`,
},
]
}
Add another rewrite rule to remove unnecessary path segment.
After upgrade to next@12.3.1, It seems fixed.
And 12.2.5 is also work as expected.
I'm still facing this issue on 13.1.1
whereby I'm using a fallback like:
fallback: [
{
source: '/:path*',
destination: `https://x.com/:path*`,
},
]
and _next/data/development/en/y.json
returns the HTML from pages/y/index.tsx
.
Verify canary release
Provide environment information
WSL:
What browser are you using? (if relevant)
No response
How are you deploying your application? (if relevant)
No response
Describe the Bug
When I config
rewrites
,_next/data
request likehttp://dev.next-ssr1.com:3000/_next/data/development/ssr1/parent/apple.json?child=apple
will rewrite to[...fallback].page.tsx
. Otherwisehttp://dev.next-ssr1.com:3000/_next/data/development/ssr1/test.json
is ok.Expected Behavior
_next/data
request should act like_next/static
?Link to reproduction
https://github.com/yunsii/next-ssr-multiple-apps
To Reproduce
pnpm install
npm run dev
http://dev.next-ssr1.com:3000/parent
Go to [child: apple] page
http://dev.next-ssr1.com:3000/_next/data/development/ssr1/parent/apple.json?child=apple
, http code is 200, but response content is[...fallback].page.tsx
, json data[1, 2, 3, 4]
, expected[1, 2, 3]
In contrast, from
/
to/test
will findtest.json
is ok.