NextJS server is intercepting POST requests that _should_ be handled by rewrites, and treating them as GET #65626
Labels
bug
Issue was opened via the bug report template.
Navigation
Related to Next.js linking (e.g., <Link>) and navigation.
Pages Router
Related to Pages Router.
Link to the code that reproduces this issue
https://github.com/etnichols/nextjs-rewrite-bug-repro
To Reproduce
npm i
npm run dev
localhost:3000
. The server exposes a single page at/checkout/billing/[id]
.localhost:3000/checkout/billing/1234
and observe the following page is rendered as expected:rewrite
fallback block defined innext.config.mjs
.Current vs. Expected behavior
The NextJS server is treating POST requests to endpoints as GET requests, and incorrectly serves back HTML to the POST request, instead of either 1) using the next js fallback rewrite config or 2) simply returning a 404.
Expected behavior: given a POST request to some NextJS server which does not have an API route configured, appropriately using rewrite config, or return a 404.
Provide environment information
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.1.0: Mon Oct 9 21:28:45 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T6020 Available memory (MB): 16384 Available CPU cores: 12 Binaries: Node: 18.17.1 npm: 9.6.7 Yarn: N/A pnpm: 8.7.6 Relevant Packages: next: 14.2.3 // Latest available version is detected (14.2.3). eslint-config-next: 14.2.3 react: 18.3.1 react-dom: 18.3.1 typescript: 5.4.5 Next.js Config: output: N/A
Which area(s) are affected? (Select all that apply)
Navigation, Pages Router
Which stage(s) are affected? (Select all that apply)
next dev (local), Vercel (Deployed)
Additional context
We have a production app exhibiting this behavior as well.
The text was updated successfully, but these errors were encountered: