nextjs - 💡(How to fix) Fix proxy.ts is not being invoked (only on Vercel) when using basePath [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#86250Fetched 2026-04-08 02:11:53
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×2closed ×1commented ×1issue_type_added ×1

Root Cause

it's showing 404 because next-intl inside the proxy not providing locale route to the response

Code Example

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.5.0: Tue Apr 22 19:53:27 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6041
  Available memory (MB): 24576
  Available CPU cores: 14
Binaries:
  Node: 23.9.0
  npm: 11.2.0
  Yarn: N/A
  pnpm: 10.18.3
Relevant Packages:
  next: 16.0.3 
recommended!
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.8.3
Next.js Config:
  output: N/A

---

export const config = {
  matcher: [
    "/(en-us|ar-iq)/:path*",
    "/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).)*",
  ],
};
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://pro-i86dao4df-noor-al-darrajis-projects.vercel.app/pro

To Reproduce

This link is deployed 16.0.3 nextjs: https://pro-i86dao4df-noor-al-darrajis-projects.vercel.app/pro

it's showing 404 because next-intl inside the proxy not providing locale route to the response

and here it's a downgraded version : https://pro-d3rwvnniv-noor-al-darrajis-projects.vercel.app/pro

and the only thing is different is the proxy.ts to middleware.ts and "next" from 16.0.3 to 15.5.4 while the basePath remains the same basePath: "/pro",

Current vs. Expected behavior

The issue is the proxy.ts is not being invoked at all using basePath at all when looking at Runtime logs on Vercel while everything looks fine on dev mode locally

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.5.0: Tue Apr 22 19:53:27 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6041
  Available memory (MB): 24576
  Available CPU cores: 14
Binaries:
  Node: 23.9.0
  npm: 11.2.0
  Yarn: N/A
  pnpm: 10.18.3
Relevant Packages:
  next: 16.0.3 
recommended!
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  typescript: 5.8.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Middleware

Which stage(s) are affected? (Select all that apply)

Vercel (Deployed)

Additional context

I was thinking i's a matcher issue but I even only kept "/" as a matcher and still didn't run

my current proxy.ts matcher:

export const config = {
  matcher: [
    "/(en-us|ar-iq)/:path*",
    "/((?!_next/static|_next/image|favicon.ico|.*\\.(?:svg|png|jpg|jpeg|gif|webp)$).)*",
  ],
};

extent analysis

TL;DR

The issue can be resolved by adjusting the matcher configuration in proxy.ts to correctly handle the basePath and locale routes.

Guidance

  • Verify that the basePath is correctly set to /pro in the Next.js configuration and that it matches the expected route.
  • Check the Vercel deployment configuration to ensure that the basePath is properly handled.
  • Consider simplifying the matcher configuration to a single, more general pattern to test if the issue is related to the complex matching rules.
  • Review the Next.js documentation for basePath and matcher configuration to ensure that the setup is correct.

Example

No code example is provided as the issue is more related to configuration and setup.

Notes

The issue seems to be related to the basePath and matcher configuration in proxy.ts and how it interacts with the Vercel deployment. Further investigation is needed to determine the exact cause.

Recommendation

Apply workaround: Adjust the matcher configuration to simplify the patterns and test if the issue persists. This will help determine if the issue is related to the complex matching rules.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING