Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add headersTimeout to the server parameters #75424

Open
wants to merge 1 commit into
base: canary
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions packages/next/src/server/lib/start-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export interface StartServerOptions {
customServer?: boolean
minimalMode?: boolean
keepAliveTimeout?: number
headersTimeout?: number
// this is dev-server only
selfSignedCertificate?: SelfSignedCertificate
}
Expand All @@ -61,6 +62,7 @@ export async function getRequestHandlers({
hostname,
minimalMode,
keepAliveTimeout,
headersTimeout,
experimentalHttpsServer,
quiet,
}: {
Expand All @@ -72,6 +74,7 @@ export async function getRequestHandlers({
hostname?: string
minimalMode?: boolean
keepAliveTimeout?: number
headersTimeout?: number
experimentalHttpsServer?: boolean
quiet?: boolean
}): ReturnType<typeof initialize> {
Expand All @@ -84,6 +87,7 @@ export async function getRequestHandlers({
minimalMode,
server,
keepAliveTimeout,
headersTimeout,
experimentalHttpsServer,
startServerSpan,
quiet,
Expand All @@ -100,6 +104,7 @@ export async function startServer(
minimalMode,
allowRetry,
keepAliveTimeout,
headersTimeout,
selfSignedCertificate,
} = serverOptions
let { port } = serverOptions
Expand Down Expand Up @@ -192,6 +197,9 @@ export async function startServer(
if (keepAliveTimeout) {
server.keepAliveTimeout = keepAliveTimeout
}
if (headersTimeout) {
server.headersTimeout = headersTimeout
}
server.on('upgrade', async (req, socket, head) => {
try {
await upgradeHandler(req, socket, head)
Expand Down Expand Up @@ -355,6 +363,7 @@ export async function startServer(
hostname,
minimalMode,
keepAliveTimeout,
headersTimeout,
experimentalHttpsServer: !!selfSignedCertificate,
})
requestHandler = initResult.requestHandler
Expand Down
Loading