Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

feat(nitro): add http.server timeout configuration #3153

Closed
wants to merge 1 commit into from
Closed
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
10 changes: 10 additions & 0 deletions packages/nitro/src/runtime/entries/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ const server = cert && key ? new HttpsServer({ key, cert }, handle) : new HttpSe
const port = (destr(process.env.NUXT_PORT || process.env.PORT) || 3000) as number
const hostname = process.env.NUXT_HOST || process.env.HOST || 'localhost'

if (process.env.NITRO_TIMEOUT) {
server.timeout = destr(process.env.NITRO_TIMEOUT) as number
}
if (process.env.NITRO_KEEP_ALIVE_TIMEOUT) {
server.keepAliveTimeout = destr(process.env.NITRO_KEEP_ALIVE_TIMEOUT) as number
}
if (process.env.NITRO_HEADERS_TIMEOUT) {
server.headersTimeout = destr(process.env.NITRO_HEADERS_TIMEOUT) as number
}

// @ts-ignore
server.listen(port, hostname, (err) => {
if (err) {
Expand Down