import type { NextConfig } from "next"; const fastApiTarget = ( process.env.FASTAPI_PROXY_TARGET || process.env.BACKEND_API_BASE_URL || process.env.API_PROXY_TARGET || "http://127.0.0.1:8000" ).replace(/\/$/, ""); const nextConfig: NextConfig = { async rewrites() { return { beforeFiles: [ { source: "/api/:path((?!(?:digital|media)(?:$|/.*)).*)", destination: `${fastApiTarget}/api/:path*`, }, ], }; }, allowedDevOrigins: [ "localhost", "localhost:3000", "127.0.0.1", "127.0.0.1:3000", "172.27.128.1", "172.27.128.1:3000", "192.168.41.222", "192.168.41.222:3000", "192.168.41.222:3001", "http://localhost:3000", "http://127.0.0.1:3000", "http://172.27.128.1:3000", "http://192.168.41.222:3000", ], }; export default nextConfig;