proxy.ts を作って書き換えましたが、戻せるように middleware.ts も残しておきました。ビルドするとどうなりますか。
proxy.ts
Buildで実行
import { NextResponse } from 'next/server' Serverで実行
export default function proxy() {Serverで実行
return NextResponse.next()Serverで実行
}出典nextjs.org/docs/messages/middleware-to-proxynextjs.org/docs/app/api-reference/file-conventions/proxy