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