Default node preset should let you set keepAliveTimeout & headersTimeout
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?
There is already a pull request: https://github.com/unjs/nitro/pull/1944
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.