I have setup node api project in ec2. AWS architecture is something looks like as shown below
Api.com > route53 > application load balancer > nginx > node application serve through pm2.
Test case and issue I am facing:
When I call api with postman, I get proper response with 200 status. In pm2 logs, I can get "/healthcheck". If I continue to hit api without stoping it will return proper response.
But if I stop calling api, and try after 1 minute or few seconds, I get "Error: connect ETIMEDOUT 100.88.99.197:443". In api pm2 logs, I cannot get "/healthcheck". Pm2 also show process running without error. And if I continue to hit again and again, api will again start after few seconds.
Node api (without database):
app.get('/healthcheck', async function (req, res) {
console.log("/healthcheck");
res.send()
})
May be issue is with nginx keepalive or any other config settings. I request your help on this.