Replies: 12 comments 10 replies
-
I'm guessing not :( Looks like it needs to be set around here and doesn't seem like there's a way to set it: Maybe I'll make a feature request. Would rather not lose features to set up a custom server just to get nextjs working properly on AWS. |
Beta Was this translation helpful? Give feedback.
-
Heya the only solution I was able to find was to modify the IdleTimeout on the AWS ELB to be 4 seconds, i.e 1 second less than node's default 5 seconds. Which isn't optimal I don't think. |
Beta Was this translation helpful? Give feedback.
-
As the question was not answered and the issue persists i wanted to revive it. Has anyone been able to change the default keep-alive timeout for the server ? |
Beta Was this translation helpful? Give feedback.
-
I am also facing the same problem. I can only tweak port and hostname for the server and nothing else. This is the only issue which may potentially force us to move to a custom server, which we really do not want to maintain. |
Beta Was this translation helpful? Give feedback.
-
Has anyone been able to find a solution to this? |
Beta Was this translation helpful? Give feedback.
-
We're using patch-package to fix this issue, please make |
Beta Was this translation helpful? Give feedback.
-
We are doing something similar to patch, just an |
Beta Was this translation helpful? Give feedback.
-
Added a feature request here: #28633 |
Beta Was this translation helpful? Give feedback.
-
I tested out an extremely hacky solution for this that resolved our 502s. I ran a load test before and after adding this to our Docker build, and the results are definitive: no more 502s.
Disclaimer: You probably want to work this example a bit before using it in production. |
Beta Was this translation helpful? Give feedback.
-
@jordie23 @eretica and anyone else interested. @timneutkens has re-evaluated and is open to a PR that fixes this. #28642 (reply in thread) |
Beta Was this translation helpful? Give feedback.
-
I'm running next@12.3.1 and building the standalone project with docker. I took an approach similar to @danroestorf. Sharing it in case someone needs a hand: ...
RUN npm run build
RUN echo "server.keepAliveTimeout = 65000; server.headersTimeout = 66000;" >> ./.next/standalone/server.js
... |
Beta Was this translation helpful? Give feedback.
-
Hey guys. Using next 12 it seem like there is a
|
Beta Was this translation helpful? Give feedback.
-
NodeJS defaults
keepAliveTimeout
to 5 seconds. When NextJS is behind an AWS ELB/ALB, it can cause occasional 502 errors as the ELB's timeout is longer than Next's, which it should be the other way around. Also need to be able to configureheadersTimeout
for this circumstance.More info can be found here: https://shuheikagawa.com/blog/2019/04/25/keep-alive-timeout/
Beta Was this translation helpful? Give feedback.
All reactions