Skip to content

Commit 7a9bcc0

Browse files
Normalize proxied API paths
1 parent b1db19a commit 7a9bcc0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

web/app/api/proxy/[...path]/route.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ type RouteContext = {
99
};
1010

1111
export async function GET(request: NextRequest, { params }: RouteContext) {
12-
const upstreamPath = params.path.join("/");
12+
const normalizedPath = params.path[0] === "api" ? params.path.slice(1) : params.path;
13+
const upstreamPath = normalizedPath.join("/");
1314
const upstreamUrl = new URL(`${API_BASE}/api/${upstreamPath}`);
1415
upstreamUrl.search = request.nextUrl.search;
1516

0 commit comments

Comments
 (0)