import { NextResponse } from 'next/server' export function middleware(request) { const backendUrl = process.env.BACKEND_URL || 'http://localhost:8080' const { pathname, search } = request.nextUrl return NextResponse.rewrite(new URL(pathname + search, backendUrl)) } export const config = { matcher: '/api/:path*', }