CLI to build and develop Next.js apps for Cloudflare Pages
### next-on-pages environment related information System: Platform: linux Arch: x64 Version: #202405300957~1738770968~22.04~d5f7c84 SMP PREEMPT_DYNAMIC Wed F CPU: (20) x64 12th Gen Intel(R) Core(TM) i9-12900H Memory: 31 GB Shell: /bin/zsh Package Manager Used: npm (10.9.2) Relevant Packages: @cloudflare/next-on-pages: 1.13.8 vercel: N/A next: 15.2.0 ### Description When sending a custom status code using `NextResponse.rewrite` Next On Pages does not use that code. Instead it always send 200. ### Reproduction Example code; ```ts if (req.nextUrl.href.includes("statusCode")) { const status = Number(req.nextUrl.searchParams.get("statusCode")); console.log("Middleware should respond with status code:", status); return NextResponse.rewrite(req.url, { status, headers: { ...req.headers, "X-Status": String(status), }, }); } ``` Example repo; https://github.com/yoohahn/next-test ```bash $ yarn start # to test nextjs deploy localy $ yarn preview # to test pages deploy localy ``` When I go to `https://localhost:3333/?statusCode=404` I expect the status code to be 404. That is correct when deploying to Vercel or running locally. If I host in Pages and go to the same URL I expect 404, but I get 200. `https://localhost:8788/?statusCode=404`. ### Pages Deployment Method None ### Pages Deployment ID _No response_ ### Additional Information I was trying to set next on pages locally but `e2e` hangs on fixtures and I cant get it to run locally. So sadly I can't fix it my self :( ### Would you like to help? - [x] Would you like to help fixing this bug?
This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be still under discussion. The issue was opened by yoohahn and has received 0 comments.