Files
IdP/apps/docs/next.config.ts
2026-06-29 15:02:01 +03:00

37 lines
876 B
TypeScript

import type { NextConfig } from 'next';
function resolveInternalApiUrl(fallback = 'http://localhost:3000') {
const explicit = process.env.INTERNAL_API_URL?.trim();
if (explicit) {
return explicit.replace(/\/+$/, '');
}
return fallback.replace(/\/+$/, '');
}
const internalApiUrl = resolveInternalApiUrl('http://localhost:3000');
const nextConfig: NextConfig = {
async rewrites() {
return [
{
source: '/idp-api/:path*',
destination: `${internalApiUrl}/:path*`
},
{
source: '/oauth/:path*',
destination: `${internalApiUrl}/oauth/:path*`
},
{
source: '/fedcm/:path*',
destination: `${internalApiUrl}/fedcm/:path*`
},
{
source: '/.well-known/:path*',
destination: `${internalApiUrl}/.well-known/:path*`
}
];
}
};
export default nextConfig;