generated from erangel1/generic-template
19 lines
475 B
TypeScript
19 lines
475 B
TypeScript
import type { NextConfig } from "next";
|
|
|
|
const DJANGO_URL = process.env.NEXT_PUBLIC_API_URL ?? "http://localhost:8000";
|
|
|
|
const nextConfig: NextConfig = {
|
|
// Proxy /backend/* requests to the Django API so the frontend never
|
|
// exposes the backend origin to the browser (avoids CORS in production).
|
|
async rewrites() {
|
|
return [
|
|
{
|
|
source: "/backend/:path*",
|
|
destination: `${DJANGO_URL}/:path*`,
|
|
},
|
|
];
|
|
},
|
|
};
|
|
|
|
export default nextConfig;
|