1
0
Fork 0

Set Host header in HTTP provider request

This commit is contained in:
Nikolai K 2024-10-29 15:30:38 +01:00 committed by GitHub
parent 7004f0e750
commit e8ff825ed2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 4 deletions

View file

@ -7,6 +7,7 @@ import (
"hash/fnv"
"io"
"net/http"
"strings"
"time"
"github.com/cenkalti/backoff/v4"
@ -149,7 +150,11 @@ func (p *Provider) fetchConfigurationData() ([]byte, error) {
}
for k, v := range p.Headers {
req.Header.Set(k, v)
if strings.EqualFold(k, "Host") {
req.Host = v
} else {
req.Header.Set(k, v)
}
}
res, err := p.httpClient.Do(req)