We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello,
I'm working on a project base from https://github.com/vercel/platforms where you can host multiple website using the domain as a dynamic value.
so when I'm on a public website we do a url rewrite like this in the middleware,ts:L72
return NextResponse.rewrite(new URL(`/${hostname}${path}`, req.url));
I'm trying to combine this with intlMiddleware but I cannot get it to work. Any help would be really appreciated. Thank you!
https://github.com/vercel/platforms
Steps to reproduce:
I would like to be able to do a rewrite url to look like this
return NextResponse.rewrite(new URL(`/${locale}/${hostname}${path}`, req.url));
The text was updated successfully, but these errors were encountered:
I came up with this. it would be great if someone could give his opinion.
export default async function middleware(req: NextRequest) { // ... const [, locale, ...segments] = req.nextUrl.pathname.split("/"); let intlResponse = intlMiddleware(req); if (!locales.includes(locale)) { return intlResponse; } return NextResponse.rewrite(new URL(`/${locale}/${domain}/${segments}`, req.url), intlResponse); }
Sorry, something went wrong.
This is discussed in #653, please have a look there for related discussions and options you have.
I also made a note about your use case in #653, thanks for including details about your use case!
No branches or pull requests
Description
Hello,
I'm working on a project base from https://github.com/vercel/platforms where you can host multiple website using the domain as a dynamic value.
so when I'm on a public website we do a url rewrite like this in the middleware,ts:L72
I'm trying to combine this with intlMiddleware but I cannot get it to work.
Any help would be really appreciated.
Thank you!
Verifications
Mandatory reproduction URL
https://github.com/vercel/platforms
Reproduction description
Steps to reproduce:
Expected behaviour
I would like to be able to do a rewrite url to look like this
The text was updated successfully, but these errors were encountered: