mirror of
https://github.com/coredns/coredns.git
synced 2026-08-20 23:08:28 -04:00
plugin/forward: Add http(2) host/authority header and TO server resolution (#8233)
This commit is contained in:
@@ -224,20 +224,8 @@ func parseStanza(c *caddy.Controller) (*Forward, error) {
|
||||
f.tlsConfig.ClientSessionCache = tls.NewLRUClientSessionCache(len(f.proxies))
|
||||
|
||||
for i := range f.proxies {
|
||||
// Only set this for proxies that need it.
|
||||
if transports[i] == transport.TLS {
|
||||
if tlsConfig, ok := perServerNameTlsConfig[tlsServerNames[i]]; ok {
|
||||
f.proxies[i].SetTLSConfig(tlsConfig)
|
||||
} else {
|
||||
f.proxies[i].SetTLSConfig(f.tlsConfig)
|
||||
}
|
||||
}
|
||||
|
||||
if transports[i] == transport.HTTPS {
|
||||
httpTransport := http.DefaultTransport.(*http.Transport).Clone()
|
||||
httpTransport.TLSClientConfig = f.tlsConfig
|
||||
httpTransport.MaxIdleConns = f.maxIdleConns
|
||||
httpTransport.MaxIdleConnsPerHost = f.maxIdleConns
|
||||
|
||||
c := http.Client{
|
||||
Transport: httpTransport,
|
||||
@@ -248,6 +236,15 @@ func parseStanza(c *caddy.Controller) (*Forward, error) {
|
||||
f.proxies[i].SetDOHRequestOptions(f.dohMethod)
|
||||
}
|
||||
|
||||
// Only set this for proxies that need it.
|
||||
if transports[i] == transport.TLS {
|
||||
if tlsConfig, ok := perServerNameTlsConfig[tlsServerNames[i]]; ok {
|
||||
f.proxies[i].SetTLSConfig(tlsConfig)
|
||||
} else {
|
||||
f.proxies[i].SetTLSConfig(f.tlsConfig)
|
||||
}
|
||||
}
|
||||
|
||||
f.proxies[i].SetExpire(f.expire)
|
||||
f.proxies[i].SetMaxAge(f.maxAge)
|
||||
f.proxies[i].SetMaxIdleConns(f.maxIdleConns)
|
||||
|
||||
Reference in New Issue
Block a user