Have this setup:
- expressjs server started from one node process, listening to port
8081
. - js client trying to make a request to it from another node process, using node's
http
module. - client failing with 400 error.
- same URL (http://localhost:8081/) is opening in browser just fine.
Spent a few hours trying to troubleshoot it, then tried to change the port and it worked. Turns out there is another process listening on port 8081:
$ lsof -i tcp:8081
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
EUSAManag 1187 oleksandr.suhak 4u IPv4 0xce3bb9546cff3ab1 0t0 TCP localhost:sunproxyadmin (LISTEN)
(Have no idea what EUSAManag
is)
I guess my question is: how could it be that the express server starts fine without complaining to a "port being used by another process" when the port is clearly in use. And why does it work then when accessing it from the browser, but does not work when making request from js client? Any tips on figuring out what is actually happening here?