import type { NextConfig } from "next"; const nextConfig: NextConfig = { // For local dev convenience. In production you should configure reverse proxy // and set NEXT_PUBLIC_API_BASE to your public API origin. async rewrites() { // Reverse proxy backend under a path prefix, so browser can access backend // with same-origin (no CORS): http://:7888/admin139/... const backendInternal = process.env.BACKEND_INTERNAL_URL ?? (process.env.NODE_ENV === "development" ? "http://127.0.0.1:8080" : "http://backend:8080"); return [ { // Keep /admin139 as frontend admin entry page, only proxy nested API paths. source: "/admin139/:path+", destination: `${backendInternal}/:path*`, }, ]; }, }; export default nextConfig;