Skip to content

Fix: return 405 on POST request for plain pages in dev (#38863)#94529

Open
EduardF1 wants to merge 1 commit into
vercel:canaryfrom
EduardF1:fix/issue-38863
Open

Fix: return 405 on POST request for plain pages in dev (#38863)#94529
EduardF1 wants to merge 1 commit into
vercel:canaryfrom
EduardF1:fix/issue-38863

Conversation

@EduardF1
Copy link
Copy Markdown

@EduardF1 EduardF1 commented Jun 7, 2026

Fixes #38863. The 405 check in base-server.ts relied on typeof components.Component === 'string', which is only true for pre-rendered HTML pages in production. In dev mode, pages are compiled as JS modules, so the check never triggered for plain pages. This expands the condition to also catch Pages Router pages without getServerSideProps in dev mode (!isAppPath && !hasServerProps).

(typeof components.Component === 'string' || isSSG)
(typeof components.Component === 'string' ||
isSSG ||
(!isAppPath && !hasServerProps))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New 405 condition (!isAppPath && !hasServerProps) incorrectly rejects non-GET/HEAD requests for Pages-Router pages that use getInitialProps, returning 405 where they previously rendered.

Fix on Vercel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

POST request succeeds for pages with next dev

1 participant