Skip to content

Commit

Permalink
chore: rewrite (#2693)
Browse files Browse the repository at this point in the history
  • Loading branch information
guanbinrui committed Sep 28, 2024
1 parent cfedcc3 commit d7bfcca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
6 changes: 6 additions & 0 deletions src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ export async function middleware(request: NextRequest) {
const pathname = request.nextUrl.pathname;
request.headers.set('X-URL', request.url);

if (request.nextUrl.host === 'cz.firefly.social' && pathname === '/') {
return NextResponse.rewrite(new URL('/activity/cz', request.url), {
request,
});
}

if (isMatchedDiscoverPage(pathname)) {
return NextResponse.rewrite(new URL(`/discover${pathname}`, request.url), {
request,
Expand Down
14 changes: 1 addition & 13 deletions vercel.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,5 @@
]
}
],
"redirects": [],
"rewrites": [
{
"source": "/",
"has": [
{
"type": "host",
"value": "cz.firefly.social"
}
],
"destination": "/activity/cz"
}
]
"redirects": []
}

0 comments on commit d7bfcca

Please sign in to comment.