Next.js 16: rewrite/proxy no longer works in production (500), but works in dev
Link to the code that reproduces this issue
https://github.com/TheDanniCraft/clipify
To Reproduce
- Start the server in dev mode
- the URL
/js/script.file-downloads.hash.outbound-links.tagged-events.jsis correctly proxied tohttps://analytics.thedannicraft.de//js/script.file-downloads.hash.outbound-links.tagged-events.js - Build (
next build --webpack) - Start (
next start) - On prod build
/js/script.file-downloads.hash.outbound-links.tagged-events.jsreturnsHTTP 500 Internal Server Error
Current vs. Expected behavior
Expected behavior (worked in next v15 before upgrading to next v16)
The rewrite should behave the same way in production as in development and proxy the file to: https://analytics.thedannicraft.de//js/script.file-downloads.hash.outbound-links.tagged-events.js
Actual behavior:
Dev mode: Works as expected Production build: Returns 500
I also verified the rewrite exists at build time by logging (when next config is parsed):
const rewrites = await config.rewrites();
console.log(rewrites.find(r => r.source === "/js/script.file-downloads.hash.outbound-links.tagged-events.js"));
Provide environment information
Operating System:
Platform: win32
Arch: x64
Version: Windows 10 Pro
Available memory (MB): 8035
Available CPU cores: 8
Binaries:
Node: 22.14.0
npm: 11.4.2
Yarn: N/A
pnpm: N/A
Relevant Packages:
next: 16.0.8
eslint-config-next: N/A
react: 19.2.1
react-dom: 19.2.1
typescript: 5.9.3
Next.js Config:
output: standalone
Which area(s) are affected? (Select all that apply)
Webpack, Output, Pages Router
Which stage(s) are affected? (Select all that apply)
next build (local), next start (local)
Additional context
No response
Currently investigating this issue locally. I’ll share logs and a potential fix/workaround once I pinpoint the cause.
@anish-devgit thanks. I'm completly stuck with it and couldn't find an issue.
@anish-devgit Have a simmilar issue with nextv16 and my cookie banner. Please find a fix. Also tried with canary, same issue. My standalone .next folder contains the rewrites file.
@anish-devgit you found the issue? please its driving me crazy
@MrBuBBLs i see you reacted, you have the same problem and maybe found a soulution? I'm stuck and cant get thsi shit fixed...
Hello???? Nice ignoring @anish-devgit
Seems like noone hee is abel to fix this. thanks for nothing. Fuck nextjs... this v16 release seems to be half baked and broken...
Break existing apps and make half of the internet hackable. Feels like every new day/week comes with a new critical vun... But yea keep bumping prices for you shit, overpriced platform and ignore issues liek completely broken routing...
Hidden as abuse nice. You guys wanted to reply and pressed the wrong button?
I have submitted a fix in #87244. I was able to reproduce the 500 error locally and confirmed that this PR resolves it in standalone mode.
@anish-devgit thanks. then its just waiting for the vercel team to review it so we will get it in next v265383453453.0.0 😂
@anish-devgit
I have submitted a fix in #87244. I was able to reproduce the 500 error locally and confirmed that this PR resolves it in standalone mode.
Thanks. Hope this gets merged soon ❤️
pls pls pls i lost soo much time lately with this :(
I am facing same kind of issue i upgrade next 15 to 16 and proxy not loading for me and then i create new next app latest for test and in that app proxy are working i can see in the terminal that proxy(middleware) loads
When will a patch be released for this issue?
@ivan-ltp Thats the fun part: Never. Vercel prioritizes shit ai agents over fixing nextjs breaking bugs.