25 lines
702 B
TypeScript
25 lines
702 B
TypeScript
import type { NextConfig } from "next";
|
|
|
|
// Backend URL used for the SERVER-SIDE /api rewrite. Must resolve on the
|
|
// Docker network, so it must NOT be a public origin (that would create a loop).
|
|
// Use BACKEND_INTERNAL_URL (set at container runtime) so client components can
|
|
// independently use NEXT_PUBLIC_API_URL (public origin, baked at build time).
|
|
const API_BASE =
|
|
process.env.BACKEND_INTERNAL_URL ||
|
|
process.env.NEXT_PUBLIC_API_URL ||
|
|
"http://backend:8000";
|
|
|
|
const nextConfig: NextConfig = {
|
|
output: "standalone",
|
|
async rewrites() {
|
|
return [
|
|
{
|
|
source: "/api/:path*",
|
|
destination: `${API_BASE}/api/:path*`,
|
|
},
|
|
];
|
|
},
|
|
};
|
|
|
|
export default nextConfig;
|