You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Run next info (available from version 12.0.8 and up)
No response
What version of Next.js are you using?
12.0.7
What version of Node.js are you using?
v14.15.4
What browser are you using?
chrome
What operating system are you using?
macOS
How are you deploying your application?
vercel
Describe the Bug
While rewriting subdomain in middleware, page is not loaded based on locale prefix.
import { NextResponse } from 'next/server';
export function middleware(req, ev) {
...
// rewrite
if (
!pathname.includes('.') && // exclude all files in the public folder
!pathname.startsWith('/api') // exclude all API routes
) {
return NextResponse.rewrite(`/a/${subdomain}`); // return 404 not found
}
return response;
}
I tried return NextResponse.rewrite("/en/a/support") instead. In this case, the first hit returns white screen. second hit returns proper page.
Note that /a/support page use getStaticProps and getStaticPaths with fallback=true.
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
vercel
locked as resolved and limited conversation to collaborators
Feb 4, 2022
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Run
next info
(available from version 12.0.8 and up)No response
What version of Next.js are you using?
12.0.7
What version of Node.js are you using?
v14.15.4
What browser are you using?
chrome
What operating system are you using?
macOS
How are you deploying your application?
vercel
Describe the Bug
While rewriting subdomain in middleware, page is not loaded based on locale prefix.
I tried
return NextResponse.rewrite("/en/a/support")
instead. In this case, the first hit returns white screen. second hit returns proper page.Note that
/a/support
page usegetStaticProps
andgetStaticPaths
withfallback=true
.Sharing next.config.js
Expected Behavior
return NextResponse.rewrite(
/en/a/${subdomain}
) should workTo Reproduce
i18n
setting in next.config.jsprepare ISR page
In middleware, rewrite without locale preifx. e.g.
return NextResponse.rewrite(
/a/abc)
The text was updated successfully, but these errors were encountered: