joesan
joesan

Reputation: 15385

Connection refused / couldn't connect to host

I have a process that is running on a specific port on my remote Ubuntu machine and I'm exposing that port via HTTP. When I tried to connect with my client using curl, I'm not able to connect, but if I do the same call on the remote machine locally, I can see that it connects. So I'm pretty sure that it is a network issue, but just not sure what it is?

Even trying on the remote host, I get the same error if I give the actual IP address of the machine!

Joes-MacBook-Pro:~ joe$ curl --verbose --insecure --cert .docker/cert.pem --key .docker/key.pem https://my.ip.address:1234/images/json  
* About to connect() to my.ip.address port 1234 (#0)  
*   Trying my.ip.address... Connection refused  
* couldn't connect to host  
* Closing connection #0  
curl: (7) couldn't connect to host  
Joes-MacBook-Pro:~ joe$ 

Upvotes: 6

Views: 17806

Answers (3)

Peng Liu
Peng Liu

Reputation: 51

I think i meet the same problem. At last I tried another port, and it worked. So maybe you can change the port.

Upvotes: 1

Hans Z.
Hans Z.

Reputation: 53908

I don't see the topic title text in the output of the command so I'm not sure if that is actually related. To me the command output and the described behavior suggest that the server process binds explicitly to 127.0.0.1 only instead of binding to the public IP address or the 0.0.0.0 any address, you could check that.

Upvotes: 0

Keshav Kalra
Keshav Kalra

Reputation: 315

Please check your curl version first if it's greater than 7.33.0-3

Downgrade curl to 7.33.0-3. There is a known bug that is now fixed and should be released with the next version. I got bit by this too.

Reference Link : https://bbs.archlinux.org/viewtopic.php?id=175433 http://sourceforge.net/p/curl/bugs/1319/

Upvotes: 4

Related Questions