13

I'm trying to test the SSL connection on one of my servers. The server is behind a load balancer (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:1.1.1.1' 'https://myservice.com'

but when I do:

curl --resolve 'myservice.com:8090:2.2.2.2' '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:2.2.2.2 to DNS cache
* About to connect() to myservice.com port 443 (#0)
*   Trying 3.3.3.3...
* Connected to myservice.com (3.3.3.3) port 443 (#0)

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

Thanks.

4
  • 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/1.2.3.4 libidn/1.23 librtmp/2.3 Oct 1, 2013 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. Oct 1, 2013 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 :) Oct 1, 2013 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. Oct 2, 2013 at 0:24

2 Answers 2

2

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

5

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' 'https://2.2.2.2:8090'

or with more verbose terms:

curl --insecure --header 'Host: myservice.com' 'https://2.2.2.2:8090'

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .