nitro icon indicating copy to clipboard operation
nitro copied to clipboard

Default node preset should let you set keepAliveTimeout & headersTimeout

Open hecktarzuli opened this issue 1 year ago • 4 comments

Describe the feature

In larger environments that get a decent amount of traffic, it's important that the node keepAliveTimeout & headersTimeout are able to be set (the default is 5s for keepAliveTimeout). Currently the only way to do that is to add it to the generated file post-build (fragile), or create a whole new preset on your own (and lose all of the great stuff already in the current preset)

In our prod env (50+ servers), we were getting tens of thousands of 502's per day because the node keepAliveTimeout was so low compared to our Application Load Balancer idleTimeout (30s)

related: https://github.com/nuxt/nuxt/issues/18857 https://github.com/nuxt/nuxt/issues/9740

Additional information

  • [ ] Would you be willing to help implement this feature?

hecktarzuli avatar Jul 31 '24 15:07 hecktarzuli

There is already a pull request: https://github.com/unjs/nitro/pull/1944

unite4 avatar Aug 21 '24 07:08 unite4

There is already a pull request: #1944

PR is closed. Was there another solution?

markcrivera avatar Oct 03 '25 20:10 markcrivera

There is already a pull request: #1944

PR is closed. Was there another solution?

It's not pretty, but in my Nuxt 4 project i do this. (did something similar in Nuxt 3)

"scripts": {
"build": "nuxt build && echo 'listener.keepAliveTimeout = 35000;listener.headersTimeout = 36000;' >> .output/server/chunks/nitro/nitro.mjs"
}

The only other option that I know of is to create your own preset, but I don't want to do all that just for 2 settings.

hecktarzuli avatar Oct 03 '25 20:10 hecktarzuli