Skip to content

Commit

Permalink
Set ServerName explicitly in TLSConfig to ensure SNI works
Browse files Browse the repository at this point in the history
Sometime since I first wrote the ACME (Let's Encrypt) code,
and today, golang needs this extra ServerName to be set explicitly
in the TLSConfig.

This is to avoid domain fronting.

golang/go#22704
  • Loading branch information
archis-polyverse committed Jul 7, 2018
1 parent c52e3e4 commit c05736e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion testutils/utils.go
Expand Up @@ -131,7 +131,10 @@ func MakeRequest(url string, opts ...ReqOption) (*http.Response, []byte, error)
if strings.HasPrefix(url, "https") {
tr = &http.Transport{
DisableKeepAlives: true,
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
TLSClientConfig: &tls.Config{
InsecureSkipVerify: true,
ServerName: request.Host,
},
}
} else {
tr = &http.Transport{
Expand Down

0 comments on commit c05736e

Please sign in to comment.