Next.js Discord

Discord Forum

Routing in multizone is not working as expected in dev server

Unanswered
Spectacled bear posted this in #help-forum
Open in Discord
Spectacled bearOP
The config in main app
const { BLOG_URL } = process.env;
/** @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
/** @type {import('next').NextConfig} */
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.

And other thing is im unable to route back to the home page with config in blog app

0 Replies