@@ -37,9 +37,11 @@ const (
37
37
Default = 2
38
38
)
39
39
40
- var awsUrlRegexp = regexp .MustCompile (`([a-z0-9-]+).es.amazonaws.com$` )
41
- var awsOpensearchServerlessUrlRegexp = regexp .MustCompile (`([a-z0-9-]+).aoss.amazonaws.com$` )
42
- var minimalOpensearchServerlessVersion = "2.0.0"
40
+ var (
41
+ awsUrlRegexp = regexp .MustCompile (`([a-z0-9-]+).es.amazonaws.com$` )
42
+ awsOpensearchServerlessUrlRegexp = regexp .MustCompile (`([a-z0-9-]+).aoss.amazonaws.com$` )
43
+ minimalOpensearchServerlessVersion = "2.0.0"
44
+ )
43
45
44
46
type ProviderConf struct {
45
47
rawUrl string
@@ -487,7 +489,9 @@ func awsSession(region string, conf *ProviderConf, endpoint string) *awssession.
487
489
sessOpts .Profile = conf .awsProfile
488
490
}
489
491
490
- transport := http.Transport {}
492
+ transport := http.Transport {
493
+ Proxy : http .ProxyFromEnvironment ,
494
+ }
491
495
// If configured as insecure, turn off SSL verification
492
496
if conf .insecure {
493
497
transport .TLSClientConfig = & tls.Config {InsecureSkipVerify : true }
@@ -514,12 +518,13 @@ func awsHttpClient(region string, conf *ProviderConf, headers map[string]string)
514
518
// Set the proxy URL after configuring AWS credentials since the proxy
515
519
// should be not used for credential sources that call a URL like ECS Task
516
520
// Roles or EC2 Instance Roles.
521
+ transport , _ := session .Config .HTTPClient .Transport .(* http.Transport )
522
+ transport .Proxy = http .ProxyFromEnvironment
517
523
if conf .proxy != "" {
518
524
proxyURL , _ := url .Parse (conf .proxy )
519
- transport , _ := session .Config .HTTPClient .Transport .(* http.Transport )
520
525
transport .Proxy = http .ProxyURL (proxyURL )
521
- session .Config .HTTPClient .Transport = transport
522
526
}
527
+ session .Config .HTTPClient .Transport = transport
523
528
524
529
signer := awssigv4 .NewSigner (session .Config .Credentials )
525
530
client , err := aws_signing_client .New (signer , session .Config .HTTPClient , conf .awsSig4Service , region )
@@ -547,7 +552,10 @@ func tokenHttpClient(conf *ProviderConf, headers map[string]string) *http.Client
547
552
}
548
553
549
554
// Wrapper to inject headers as needed
550
- transport := & http.Transport {TLSClientConfig : tlsConfig }
555
+ transport := & http.Transport {
556
+ TLSClientConfig : tlsConfig ,
557
+ Proxy : http .ProxyFromEnvironment ,
558
+ }
551
559
// Configure a proxy URL if one is provided.
552
560
if conf .proxy != "" {
553
561
proxyURL , _ := url .Parse (conf .proxy )
@@ -601,7 +609,10 @@ func tlsHttpClient(conf *ProviderConf, headers map[string]string) *http.Client {
601
609
tlsConfig .ServerName = conf .hostOverride
602
610
}
603
611
604
- transport := & http.Transport {TLSClientConfig : tlsConfig }
612
+ transport := & http.Transport {
613
+ TLSClientConfig : tlsConfig ,
614
+ Proxy : http .ProxyFromEnvironment ,
615
+ }
605
616
// Configure a proxy URL if one is provided.
606
617
if conf .proxy != "" {
607
618
proxyURL , _ := url .Parse (conf .proxy )
@@ -628,7 +639,10 @@ func defaultHttpClient(conf *ProviderConf, headers map[string]string) *http.Clie
628
639
tlsConfig .ServerName = conf .hostOverride
629
640
}
630
641
631
- transport := & http.Transport {TLSClientConfig : tlsConfig }
642
+ transport := & http.Transport {
643
+ TLSClientConfig : tlsConfig ,
644
+ Proxy : http .ProxyFromEnvironment ,
645
+ }
632
646
// Configure a proxy URL if one is provided.
633
647
if conf .proxy != "" {
634
648
proxyURL , _ := url .Parse (conf .proxy )
0 commit comments