I'm trying to test the SSL connection on one of my servers. The server is behind a LB so it's listening for SSL connections on the port 8090.

I have use the --resolve option to test when talking to the LB which listens on port 443.

curl --resolve 'myservice.com:443:' 'https://myservice.com'

but when I do:

curl --resolve 'myservice.com:8090:' 'https://myservice.com:8090'

curl simply ignores the port and goes with 443. Of-course, this causes the DNS cache to miss and I end-up using the public DNS IP...

* Added myservice.com:8090: to DNS cache
* About to connect() to myservice.com port 443 (#0)
*   Trying
* Connected to myservice.com ( port 443 (#0)

How can I force curl to use the port 8090 for an SSL connection?


  • 1
    Strange... works as expected for me in curl 7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/ libidn/1.23 librtmp/2.3 – Michael - sqlbot Oct 1 '13 at 1:07
  • Interesting I'm going to upgrade my curl it looks like I installed the 7.29DEV version last time (that might be the problem). Thanks for testing. – Nicolas GUILLAUME Oct 1 '13 at 17:18
  • Alright the problem is fixed, it was actually coming from a tool that I use to construct the curl request which was dropping the header... Thank you for your time. Please post a reply so I can accept it :) – Nicolas GUILLAUME Oct 1 '13 at 17:33
  • Thanks, it didn't feel like much of an answer but at least it got you looking in different places to find your problem. – Michael - sqlbot Oct 2 '13 at 0:24

Tested with curl 7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/ libidn/1.23 librtmp/2.3, the --resolve header works as expected with https and a non-standard port specified in both places.


If --resolve is not working out, you can specify the Host header (you might need to supress certificate warnings with -k):

curl -k -H 'Host: myservice.com' ''

or with more verbose terms:

curl --insecure --header 'Host: myservice.com' ''

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.