Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

The --help output for curl lists a --resolve option, which states

--resolve <host:port:address> Force resolve of HOST:PORT to ADDRESS

I'm not having any luck getting it to work though. The basic command I'm trying to run is

curl --resolve

and I keep getting the response Couldn't resolve host ''. I want do do this because I'm testing a certificate for, but I'm not testing it on the actual server. Instead, I'm testing it on a dummy machine. I know that I can edit /etc/hosts so that resolves to localhost, but this curl approach seems like it would be the "correct" way to go, if I could make it work.

Does anybody see what I'm doing wrong here?

share|improve this question

2 Answers 2

up vote 9 down vote accepted

It appears that the address needs to be a numeric IP address, not a hostname.

Try this:

curl --resolve
share|improve this answer
And that solves it. Thank you very much! – tsuraan Mar 1 '12 at 1:15

Some additional help in troubleshooting:

Ensure you're listening the right port for the protocol: http=80; https=443 & etc

Also curl -v will give the HEADER information for the response server which can be helpful.

curl -v --resolve
## The client request headers prepended by >
> OPTIONS /v1/..
## The server response prepended by <
< HTTP/1.1 501 Not Implemented
## The html returned
<H1>Unsupported Request</H1>

Basically in this case the OPTIONS HTTP method was not implemented at the edge server for the CDN.

share|improve this answer
(1) This problem was solved almost 3½ years ago.  (2) The problem was that curl couldn't figure out what host to (attempt to) connect to.  How do the ports that you're listening on make any difference if curl never connects to the right host?  And, obviously, the user never gets an HTTP header back if he doesn't connect to any server. – G-Man Aug 27 at 23:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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