Next.js Discord

Discord Forum

Rewrite not working on deployed app

Unanswered
Spectacled bear posted this in #help-forum
Open in Discord
Spectacled bearOP
I have this rewrite config:
/** @type {import('next').NextConfig} */
const nextConfig = {
  async rewrites() {
    return [
      {
        source: "/",
        destination: "https://wax-wanderer-7334.typedream.app/",
      },
      {
        source: "/:path*",
        destination: "https://wax-wanderer-7334.typedream.app/:path*",
      },
    ];
  },
};

module.exports = nextConfig;


Locally everything works, app loads. I tried both pnpm build & pnpm start as well as pnpm dev. But when I deploy to Vercel, it doesn't work.

Here is original page:
https://wax-wanderer-7334.typedream.app/

Here is page with desired rewrite:
https://www.bubbleteabrno.cz/

According to DevTools other stuff returns 404, but... why if it works locally?

2 Replies