curl-users
Re: Specify SNI server name for HTTPS client hello
Date: Fri, 23 Jan 2015 22:48:42 +0100 (CET)
On Fri, 23 Jan 2015, Norton, Mike wrote:
> Is there a way to specify what gets used for the server name in the TLS
> client hello? I need to specify the server name to test a reverse proxy
> server that is not yet in DNS. The server requires SNI or else it will close
> the connection. I'm trying to do something like this:
>
> $ curl -k -I -H "Host: www.example.com" "https://192.0.2.1/example/"
> I want to send "www.example.com" as the HTTP host and as the TLS server
> name, but I want to connect to 192.0.2.1, which is not necessarily the same
> IP that's in DNS for that name. Is there a way to do that using command-line
> options?
You want --resolve!
--resolve <host:port:address>
Provide a custom address for a specific host and port pair.
Using this, you can make the curl requests(s) use a specified
address and prevent the otherwise normally resolved address to
be used. Consider it a sort of /etc/hosts alternative provided
on the command line. The port number should be the number used
for the specific protocol the host will be used for. It means
you need several entries if you want to provide address for the
same host but different ports.
Example:
curl -k -I --resolve www.example.com:80:192.0.2.1 https://www.example.com/
-- / daniel.haxx.se ------------------------------------------------------------------- List admin: http://cool.haxx.se/list/listinfo/curl-users FAQ: http://curl.haxx.se/docs/faq.html Etiquette: http://curl.haxx.se/mail/etiquette.htmlReceived on 2015-01-23