Skip to content

Next.js routes respond with 200 to unsupported HTTP methods #78070

@ppiwo

Description

@ppiwo

Link to the code that reproduces this issue

https://codesandbox.io/p/sandbox/github/vercel/next.js/tree/canary/examples/reproduction-template

To Reproduce

  1. Open codesandbox
  2. Copy Preview URL
  3. Using your tool of choice, make any non GET request (POST, PATCH, DELETE, etc)

Current vs. Expected behavior

Current:

  • 200 response, with HTML document matching the GET route
  • Client side error once JS loads

Application error: a client-side exception has occurred while loading (see the browser console for more information).

Expected:
405 - Method not allowed

Provide environment information

Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 23.0.0: Fri Sep 15 14:41:43 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T6000
    Binaries:
      Node: 20.9.0
      npm: 10.1.0
      Yarn: 3.5.0
      pnpm: 10.5.2
    Relevant Packages:
      next: 13.4.19
      eslint-config-next: 15.3.0
      react: 18.3.1
      react-dom: 18.3.1
      typescript: 5.8.3
    Next.js Config:
      output: N/A

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

Not sure

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

Vercel (Deployed), next start (local), next dev (local), next build (local), Other (Deployed)

Additional context

I've tested this both self hosted and on Vercel, with 200's on each. The next.js website returns a 405 as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions