web: fix api middleware #153
@@ -13,7 +13,8 @@ export function middleware(request: NextRequest) {
|
||||
}
|
||||
|
||||
const baseUrl = process.env.API_HOST.replace(/\/$/, "");
|
||||
const apiUrl = new URL(baseUrl + pathname + search);
|
||||
const path = pathname.replace(/^\/api/, "");
|
||||
const apiUrl = new URL(baseUrl + path + search);
|
||||
|
||||
return NextResponse.rewrite(apiUrl, { request });
|
||||
} else if (pathname.startsWith("/auth")) {
|
||||
|
||||
Reference in New Issue
Block a user