next.js icon indicating copy to clipboard operation
next.js copied to clipboard

Next.js 16: rewrite/proxy no longer works in production (500), but works in dev

Open TheDanniCraft opened this issue 2 weeks ago • 2 comments

Link to the code that reproduces this issue

https://github.com/TheDanniCraft/clipify

To Reproduce

  1. Start the server in dev mode
  2. the URL /js/script.file-downloads.hash.outbound-links.tagged-events.js is correctly proxied to https://analytics.thedannicraft.de//js/script.file-downloads.hash.outbound-links.tagged-events.js
  3. Build (next build --webpack)
  4. Start (next start)
  5. On prod build /js/script.file-downloads.hash.outbound-links.tagged-events.js returns HTTP 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

TheDanniCraft avatar Dec 11 '25 15:12 TheDanniCraft

Currently investigating this issue locally. I’ll share logs and a potential fix/workaround once I pinpoint the cause.

anish-devgit avatar Dec 11 '25 16:12 anish-devgit

@anish-devgit thanks. I'm completly stuck with it and couldn't find an issue.

TheDanniCraft avatar Dec 11 '25 19:12 TheDanniCraft

@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.

gltched-usr avatar Dec 12 '25 09:12 gltched-usr

@anish-devgit you found the issue? please its driving me crazy

gltched-usr avatar Dec 14 '25 00:12 gltched-usr

@MrBuBBLs i see you reacted, you have the same problem and maybe found a soulution? I'm stuck and cant get thsi shit fixed...

gltched-usr avatar Dec 14 '25 03:12 gltched-usr

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...

gltched-usr avatar Dec 15 '25 12:12 gltched-usr

Hidden as abuse nice. You guys wanted to reply and pressed the wrong button?

gltched-usr avatar Dec 16 '25 08:12 gltched-usr

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 avatar Dec 16 '25 12:12 anish-devgit

@anish-devgit thanks. then its just waiting for the vercel team to review it so we will get it in next v265383453453.0.0 😂

gltched-usr avatar Dec 16 '25 13:12 gltched-usr

@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 ❤️

TheDanniCraft avatar Dec 16 '25 17:12 TheDanniCraft

pls pls pls i lost soo much time lately with this :(

grmkris avatar Dec 16 '25 17:12 grmkris

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

SyedJunaidAli1 avatar Dec 16 '25 18:12 SyedJunaidAli1

When will a patch be released for this issue?

ivan-ltp avatar Dec 17 '25 12:12 ivan-ltp

@ivan-ltp Thats the fun part: Never. Vercel prioritizes shit ai agents over fixing nextjs breaking bugs.

gltched-usr avatar Dec 17 '25 19:12 gltched-usr