Question

I am Getting error when sending https request to my node js server from php

Posted January 28, 2020 129 views
API

I am Getting error when sending https request to my node js server from php

cURL error 7: Failed to connect to api1.waapi.site port 9000: Connection refused

I am trying to send a request to https://api1.waapi.site:9000.

Please help me.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hi @mrbarnk,

cURL error 7 is very explicit, it means for some reason you are not able to connect to the provider url. Most of the time it’s related to a firewall or some kind of a restriction issue.

Another suggestion would be that you haven’t started node to actually listen on port 9000. The last suggestion I have is that actually your firewall is blocking the access to this port.

To test the above theories, SSH to your droplet, start your NodeJS instance and type in the following

netstat -tulpen | grep 9000

If you have started the NodeJS application properly, you should see it in the output. If you do, it would mean your firewall is the issue. You’ll need to allow incoming traffic to the mentioned port. To do you need to run

iptables -A INPUT -p tcp --dport 9000 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT

If you don’t see any output, it would mean your NodeJS application hasn’t been started properly.

Regards,
KDSys

Submit an Answer