Skip to content

fix: only pass known safe server entry options to srvx - #4654

Merged
pi0 merged 1 commit into
mainfrom
fix/server-entry-middleware
Sep 22, 2026
Merged

pi0 merged 1 commit into
mainfrom
fix/server-entry-middleware

Conversation

@pi0x

@pi0x pi0x commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #4620 (not released yet).

Server entry options such as middleware, plugins and error were passed to srvx, so they only applied to the node, bun and deno presets (and nitro dev). Serverless presets and nitroApp.fetch ignored them. Request handling differed between deployments, and a security middleware could be silently skipped.

Now only an allowlist of options is passed: port, hostname, reusePort, protocol, tls, silent, gracefulShutdown, maxRequestBodySize and trustProxy. These are all safe to ignore on other presets. Runtime specific node, bun and deno options are also passed, because they name the runtime they apply to.

  • NitroServerEntry type only accepts the allowed keys.
  • middleware, plugins, error and manual are ignored. Docs point to Nitro middleware and plugins instead.
  • Regression test: the fixture still sets middleware and plugins, and the tests check they are not applied on any preset.

🤖 Generated with AI assistant

middleware, plugins and error only applied to srvx presets (node, bun, deno) and not to serverless presets or nitroApp.fetch.
@pi0x
pi0x requested a review from pi0 as a code owner September 22, 2026 19:59
@vercel

vercel Bot commented Sep 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
nitro.build Ready Ready Preview Sep 22, 2026 8:00pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 5ef0fb01-8d5e-4f22-9a2d-3bcf29b948b9

📥 Commits

Reviewing files that changed from the base of the PR and between 945a654 and 70d39a4.

📒 Files selected for processing (9)
  • docs/1.docs/6.server-entry.md
  • src/build/virtual/server-entry.ts
  • src/presets/_nitro/runtime/nitro-dev.ts
  • src/runtime/internal/serve.ts
  • src/runtime/virtual/server-entry.ts
  • src/types/srvx.ts
  • test/fixture/server.ts
  • test/presets/node.test.ts
  • test/tests.ts
 _____________________________________________________________________________________________________________
< Abstraction is not about vagueness, it is about being precise at a new semantic level. - Edsger W. Dijkstra >
 -------------------------------------------------------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Sep 22, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/nitro@4654

commit: 70d39a4

@pi0
pi0 merged commit bc29f77 into main Sep 22, 2026
14 of 15 checks passed
@pi0
pi0 deleted the fix/server-entry-middleware branch September 22, 2026 20:02

This branch was successfully deployed

1 active deployment
Preview — 70d39a4a Deployed Sep 22, 2026 by vercel[bot]
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.

2 participants