The config in main app
/** @type {import('next').NextConfig} */
const nextConfig = {
output: "standalone",
async rewrites() {
console.log("BLOG_URL", BLOG_URL);
return {
afterFiles: [
{
source: "/blog",
destination: `${BLOG_URL}/blog`,
},
{
source: "/blog/:path*",
destination: `${BLOG_URL}/blog/:path*`,
},
{
source: "/:path*",
destination: `/:path*`,
},
],
};
},
};
export default nextConfig;
The config in blog app
const nextConfig = {
basePath: "/blog",
};
export default nextConfig;
The rerouting to blog app is working only after refreshing in dev server but working properly in production build