refactor(api): add same-origin backend proxy for auth cookies

This commit is contained in:
2026-07-22 16:18:17 +05:30
parent e077467bce
commit 5d3dac0b21
4 changed files with 23 additions and 16 deletions

View File

@@ -1,7 +1,21 @@
import type { NextConfig } from 'next';
const backendOrigin = process.env.BACKEND_ORIGIN?.replace(/\/+$/, '');
if (!backendOrigin) {
throw new Error('BACKEND_ORIGIN is required');
}
const nextConfig: NextConfig = {
reactStrictMode: false,
async rewrites() {
return [
{
source: '/backend/:path*',
destination: `${backendOrigin}/:path*`,
},
];
},
};
export default nextConfig;