vercel / platforms

A full-stack Next.js app with multi-tenancy and custom domain support. Built with Next.js App Router and the Vercel Domains API.
https://app.vercel.pub
5.62k stars 735 forks source link

Middleware rewrite everything else url corrected #312

Closed Adnan0061 closed 1 year ago

Adnan0061 commented 1 year ago

for rewrite everything else to/[domain]/[path] dynamic routein the middleware file is givenreturn NextResponse.rewrite(new URL(/${hostname}${path}, req.url));which is not correct because in the URL it creates href as'http://localhost:3000/test.localhost:3000/'when I try to gotest.localhost:3000. also in the/[domain]/page.tsxparams it generates is{ domain: 'test.localhost%3A3000' }`

this PR resolves the issue. It creates href as 'http://localhost:3000/test/' in the URL and also in the /[domain]/page.tsx params it generates is { domain: 'test' }

vercel[bot] commented 1 year ago

@Adnan0061 is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.