File size: 393 Bytes
4a3842e
8fab088
73c1ae2
4a3842e
 
 
 
 
 
 
 
c3f369a
4a3842e
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import { NextResponse } from 'next/server';

const API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL || 'http://localhost:8000';

export const config = {
  matcher: '/api/solve',
};

export function middleware(req: Request) {
  const url = new URL(req.url);
  if (url.pathname === '/api/solve') {
    return NextResponse.rewrite(`${API_BASE_URL}/solve`);
  }
  return NextResponse.next();
}