Repository: next.js
Issue: Client-side routing link resolve bug in minimal mode (Vercel)
Labels: Navigation

### Verify canary release

- [X] I verified that the issue exists in the latest Next.js canary release

### Provide environment information

```bash
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Education
Binaries:
  Node: 18.12.1
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant packages:
  next: 13.2.5-canary.31
  eslint-config-next: 13.2.4
  react: 18.2.0
  react-dom: 18.2.0
```


### Which area(s) of Next.js are affected? (leave empty if unsure)

App directory (appDir: true), Routing (next/router, next/navigation, next/link)

### Link to the code that reproduces this issue

https://codesandbox.io/p/github/LuudJanssen/next-rewrites-minimal-mode/main?file=README.md&workspace=%257B%2522activeFilepath%2522%253A%2522README.md%2522%252C%2522openFiles%2522%253A%255B%2522README.md%2522%255D%252C%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522gitSidebarPanel%2522%253A%2522COMMIT%2522%252C%2522spaces%2522%253A%257B%2522clg4pj5ho008l356rcogoj6ni%2522%253A%257B%2522key%2522%253A%2522clg4pj5ho008l356rcogoj6ni%2522%252C%2522devtools%2522%253A%255B%257B%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522build%2522%252C%2522key%2522%253A%2522clg4qgl6s008v356q0tt9ytrj%2522%252C%2522isMinimized%2522%253Afalse%257D%255D%252C%2522name%2522%253A%2522build%2522%257D%252C%2522clg4qguac00fb356q630dr1tb%2522%253A%257B%2522key%2522%253A%2522clg4qguac00fb356q630dr1tb%2522%252C%2522devtools%2522%253A%255B%257B%2522type%2522%253A%2522PREVIEW%2522%252C%2522taskId%2522%253A%2522start%2522%252C%2522port%2522%253A3000%252C%2522key%2522%253A%2522clg4qgz9a00l5356q8sd6e5he%2522%252C%2522isMinimized%2522%253Afalse%252C%2522path%2522%253A%2522%252F%2522%257D%252C%257B%2522type%2522%253A%2522TASK_LOG%2522%252C%2522taskId%2522%253A%2522start%2522%252C%2522key%2522%253A%2522clg4qgv6100gm356qzoicuohu%2522%252C%2522isMinimized%2522%253Afalse%257D%255D%252C%2522name%2522%253A%2522start%2522%257D%257D%252C%2522currentSpace%2522%253A%2522clg4qguac00fb356q630dr1tb%2522%252C%2522spacesOrder%2522%253A%255B%2522clg4pj5ho008l356rcogoj6ni%2522%252C%2522clg4qguac00fb356q630dr1tb%2522%255D%252C%2522hideCodeEditor%2522%253Afalse%257D

### To Reproduce

This bug only appears when building for serverless environments. The Codesandbox link above sends you to an environment which can be built for NodeJS environments, and shows the intended behavior. I have deployed this exact version to Vercel as well: https://next-rewrites-minimal-mode-git-main-luudjanssen.vercel.app/

To reproduce the issue you have to build and start the Codesandbox environment and then in both environments:

1. Visit the main URL.
2. Click the "Go to destination page" link.
3. The Vercel version should show 'This is the catch all page which received slug: "page-source"', while the NodeJS build should (correctly) show 'This is the destination page'.
4. Refresh the page on the Vercel build. The Vercel version should now also show 'This is the destination page'.


### Describe the Bug

Context: 
- Using app directory (haven't tested pages yet).
- Using `afterFiles` rewrites.
- Only seems to happen when using this minimal localization setup, not with dynamic routes with only one parameter.

This seems to trigger a bug where the client side router resolves the wrong page in a Serverless environment. I have checked the source code a little bit, and I think the header being sent by `next/link` in 'minimal mode' (`x-matched-path`) is wrong.

### Expected Behavior

Using client side routing to go to the `/page-source/` route should go to the `[locale]/page-destination` page instead of resolving to the `[locale]/[slug]` page.

### Which browser are you using? (if relevant)

_No response_

### How are you deploying your application? (if relevant)

_No response_