next.js
1cb2a664 - Rename the experimental next start front server to Switchyard (#102035)

Commit
5 hours ago
Rename the experimental next start front server to Switchyard (#102035) ### What? Renames the experimental Go server in front of `next start` from "front server" to **Switchyard**. Also preserves the original client socket identity and request-header budget when Switchyard is enabled. | Was | Now | | --- | --- | | `packages/next/src/server/front/` (and its Go module path) | `packages/next/src/server/switchyard/` | | binary `next-front-<os>-<arch>`, log prefix `next-front:` | `switchyard-<os>-<arch>`, `switchyard:` | | `front-server.ts`, `front-binary.ts`, `front-server-env.ts` | `switchyard.ts`, `switchyard-binary.ts`, `switchyard-env.ts` | | `__NEXT_EXPERIMENTAL_FRONT_SERVER`, `__NEXT_EXPERIMENTAL_FRONT_SERVER_BINARY`, `NEXT_BUILD_FRONT_SERVER` | `__NEXT_EXPERIMENTAL_SWITCHYARD`, `__NEXT_EXPERIMENTAL_SWITCHYARD_BINARY`, `NEXT_BUILD_SWITCHYARD` | | ready line `NEXT_FRONT_READY <port>` | `NEXT_SWITCHYARD_READY <port>` | | `test/production/app-dir/front-server/`, `test/unit/front-server-watch.test.ts` | `test/production/app-dir/switchyard/`, `test/unit/switchyard-watch.test.ts` | | taskfile `front_server`, CI job `test-front-server-prod`, change group `front-server`, gate `frontServerBinary` | `switchyard`, `test-switchyard-prod`, `switchyard`, `switchyardBinary` | Function names follow the same pattern (`startSwitchyard`, `findSwitchyardBinary`, `isSwitchyardEnabled`), and comments say "Switchyard" instead of "the front". ### Why? "Front" was easy to confuse with other projects when talking about it. The security review also identified that external clients appeared local to Pages API routes and that the public parser accepted a larger header budget than Node. ### How? Renames the implementation introduced in #101695. Switchyard sends authenticated TCP peer metadata to Node, which restores the socket address before routing or upgrades and removes the internal metadata. Upstream connections are pooled separately for each client address so a socket never changes identity between clients. Existing forwarded-header semantics are preserved. The public listener enforces Node's effective header-size limit, including `--max-http-header-size`, accounting for Go's 4 KiB read-buffer allowance. Switchyard refuses configured budgets of 4 KiB or less because the standard Go server cannot enforce them. ### Verification - Production behavior and process suites: 53 tests passed with Switchyard enabled; 24 behavior tests passed with it disabled. - Go race suite passed, including forged metadata, connection isolation, and incomplete oversized headers. - `pnpm typescript` and `pnpm --filter=next types` passed. <!-- NEXT_JS_LLM --> --------- Co-authored-by: Tim Neutkens <6324199+timneutkens@users.noreply.github.com>
Author
Parents
Loading