Skip to content

Trailing Slash not works with rewrites #25104

Closed
@coderdiaz

Description

What version of Next.js are you using?

10.2.0

What version of Node.js are you using?

12.16.1

What browser are you using?

Brave

What operating system are you using?

macOS Big Sur

How are you deploying your application?

Vercel

Describe the Bug

I'm currently using the Incremental Adoption strategy for migrate my site from Wordpress to Next this requires a rewrite for all non-existing routes to the proxy.

The problem, I have enabled the redirect from /en to /en/ or /school to /school/ however the rewrite doesn't work.

Expected Behavior

If I set trailingSlash: true in the next.config.js if the path not exists the rewrite is carried out.

To Reproduce

You can disabled the trailing slash config it works correctly. This is a example pages structure:

/src
  /pages
     index.tsx
     [school].tsx

And the rewrite config:

async rewrites () {
  return {
    fallback: [
      {
        source: "/:path*",
        destination: 'https://expanish-proxy.vercel.app/:path*'
      },
    ],
  };
},

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions