I use Ubuntu 18.04 and I try to curl the unavailable resource like:

curl --connect-timeout 10

curl --connect-timeout 35

Why does it sometimes respond with curl: (7) Failed to connect to port 80: No route to host, and sometimes with curl: (28) Connection timed out after 35001 milliseconds, even on the same timeout?

EDIT: I now tried making HTTP request with nodeJS's http request library from the same Ubuntu client. And sometimes I get Error: connect ETIMEDOUT and other times I get Error: connect EHOSTUNREACH

  • --verbose or --trace should provide some more info on what curl is doing behind the scenes. I wonder if it's a bad firewall configuration on the server. – Haxiel Mar 12 at 11:19

check port 80 port is running or not using below command. if it's running then check filewall(iptables) it is open or not. also, check route is available for provided host. If it is the same server then try with curl http://localhost also . sudo netstat -tulnp | grep 80

  • 1
    You want me to check that on the server or on the client? I did on the client and I got no results from this command. This server does not exist at the moment, so it is unavailable. I'm asking about the error messages I'm getting in response. – croraf Mar 12 at 9:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.