Skip to content

next.config rewrites don't get handled properly #766

@nicholas-c

Description

@nicholas-c

When setting up next.config rewrites, they don't seem to be playing nicely with query parameters with pages router (Could be app router as well, but untested)

Versions

Next version: 5.2.1
Open-next version: 3.5.1

Here's an example rewrites I've put together;

http://github.com/nicholas-c/next-15-open-next-example/

const nextConfig: NextConfig = {
  reactStrictMode: true,
  async rewrites() {
    return [
      {
        source: "/about",
        destination: "/",
      },
      {
        source: "/account/register",
        destination: "/api/auth?tab=register",
      },
      {
        source: "/account/login",
        destination: "/api/auth",
      },
    ];
  }
}
Image

Locally this works as intended, both with yarn dev and yarn start and yields the expected results.

However when built and deployed with Open-next the query parameter gets lost.

Image

https://next-15-en.nich-carter-qza3ng.gymshark-sandbox.tools/account/register
https://next-15-en.nich-carter-qza3ng.gymshark-sandbox.tools/api/auth?tab=register

Additionally to this, because I'm piggy backing on a previous test repo I have for this; When I add back in i18n config into next.config /account/register starts to 404 in the example above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions