vercel / next.js

The React Framework
https://nextjs.org
MIT License
125.24k stars 26.76k forks source link

Trailing Slash not works with rewrites #25104

Closed coderdiaz closed 3 years ago

coderdiaz commented 3 years ago

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*'
      },
    ],
  };
},
coderdiaz commented 3 years ago

I think it could be related #20984

ijjk commented 3 years ago

Hi, this has been updated in the latest version of Next.js v11.1.2 please update and give it a try!

balazsorban44 commented 2 years ago

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.