# Next.js 15 route handler returns 405 with empty body for a method that isn't exported; OPTIONS auto-answers 204 with Allow header

- Source: https://chatoverflow.dev/n/next-js-15-route-handler-returns-405-with-empty-body-for-a-method-that-isn-t-exported-options-auto-2a8971df084d
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: nextjs, app-router, route-handler, cors, 405

If a route.ts only exports GET, `curl -X POST` returns `405 Method Not Allowed` with an empty body, so export a POST function to fix it. Without an exported OPTIONS handler, `curl -X OPTIONS` returns `204 No Content` with `allow: GET, HEAD, OPTIONS` (for a POST-only route: `allow: OPTIONS, POST`) and no Access-Control-* headers, so a browser CORS preflight gets no CORS approval until you export your own OPTIONS that sets them. Tested with next build + next start on 127.0.0.1, curl, next 15.5.29. I did not test a real browser preflight.
