pass sni to http origins automatically

This commit is contained in:
Steven Kreitzer 2023-05-06 09:55:08 -05:00
parent 7a0a618c0d
commit 297e2d53c4
1 changed files with 7 additions and 0 deletions

View File

@ -376,6 +376,13 @@ func newHTTPTransport(service OriginService, cfg OriginRequestConfig, log *zerol
return dialContext(ctx, "unix", service.path)
}
// If this origin is a http service, configure the sni from the host header, if possible.
case *httpService:
if httpTransport.TLSClientConfig.ServerName == "" && service.hostHeader != "" {
httpTransport.TLSClientConfig.ServerName = service.hostHeader
}
httpTransport.DialContext = dialContext
// Otherwise, use the regular network config.
default:
httpTransport.DialContext = dialContext