node.jsexpresskubernetesnginx

Getting connection close in http method GET in nodejs, express


Getting connection close header in response in request of method GET. When sending request of method POST the connection is keep-alive

Current stack that i have is AWS ALB that pass the request to EKS. inside the EKS i have a NGINX ingress that route the request to a specific service.

All requests are of type POST and GET. all post request to the service keep the connection alive, request of GET close the connection. When i force the header inside the response it is ignored. when i use curl i get the following response:

< HTTP/1.1 200 OK
< Date: Wed, 22 Nov 2023 10:22:03 GMT
< Content-Type: application/json; charset=utf-8
< Content-Length: 15602
< Connection: close
< X-Powered-By: Express

When i run the command directly from inside the cluster directly to the NGINX (using busybox bod) i get the following response :

< HTTP/1.1 200 OK
< Date: Wed, 22 Nov 2023 10:23:04 GMT
< Content-Type: application/json; charset=utf-8
< Content-Length: 15602
< Connection: keep-alive
< X-Powered-By: Express

help is appreciated


Solution

  • It seems that the issue come i think from the ALB and from incorrect configuration of postman.

    I had a problem in postman that i was sending empty json body: for example: {} because of leftover from previous debugs against POST method. once i removed the empty json and sent a GET request the channel was left open. If i change the and put the {} again although it is a GET request and there is no need for the body it close the channel.