From 59e5e529c6e33de1266d2ad36e213bb3d185367d Mon Sep 17 00:00:00 2001 From: itzaname <me@sliving.io> Date: Mon, 17 Mar 2025 20:25:02 -0400 Subject: [PATCH] Strip /api prefix --- web/src/middleware.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/middleware.ts b/web/src/middleware.ts index 15f7bb5..ce20731 100644 --- a/web/src/middleware.ts +++ b/web/src/middleware.ts @@ -8,6 +8,6 @@ export function middleware(request: NextRequest) { if (!process.env.API_HOST) { throw new Error("env variable \"API_HOST\" is not set") } - const url = new URL(process.env.API_HOST + request.nextUrl.pathname + request.nextUrl.search) + const url = new URL(process.env.API_HOST + request.nextUrl.pathname.replace(/^\/api/, '') + request.nextUrl.search) return NextResponse.rewrite(url, { request }) } \ No newline at end of file