possible to set tls.Config.Servername with http.client.Do

36 views
Skip to first unread message

efa...@gmail.com

unread,
Jul 15, 2019, 4:57:59 PM7/15/19
to golang-nuts
Hi,

I was wondering how one can do concurrent tls requests with one single http.Client where all the servers serving the request have their certificates from the same root CA but require different tls.Config.Servername.

Would be nice to have a function like http.client.DoWithServername(req, servername)

Regards
Fahad

Andy Balholm

unread,
Jul 15, 2019, 5:28:30 PM7/15/19
to efa...@gmail.com, golang-nuts
If you leave the Servername blank, http.Transport will get it from the HTTP request. 

Andy

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/4fd8afd1-533d-4d34-8be3-039238eea2b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

efa...@gmail.com

unread,
Jul 16, 2019, 8:53:03 AM7/16/19
to golang-nuts
Hi Andy,

thank you for your suggestion.

However in my case I am not using the server name in the HTTP request but IP address and the reason for this is that I am scraping metrics using Prometheus from each instance which respond to the server name. Also the certificate doesn't contain the IP address of the server only the server name as SAN. Therefore I need a way to set the tls.Config.Servername for each HTTP request else the tls handshake fails. Or do you know another way to solve this issue?

Regards
Fahad


Den måndag 15 juli 2019 kl. 23:28:30 UTC+2 skrev Andy Balholm:
If you leave the Servername blank, http.Transport will get it from the HTTP request. 

Andy

On Jul 15, 2019, at 12:27 PM, efa...@gmail.com wrote:

Hi,

I was wondering how one can do concurrent tls requests with one single http.Client where all the servers serving the request have their certificates from the same root CA but require different tls.Config.Servername.

Would be nice to have a function like http.client.DoWithServername(req, servername)

Regards
Fahad

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golan...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages