diff --git a/restapi/client-admin.go b/restapi/client-admin.go index fedc27853a..197f0d06f4 100644 --- a/restapi/client-admin.go +++ b/restapi/client-admin.go @@ -25,7 +25,6 @@ import ( "net/http" "net/url" "strings" - "sync" "time" "github.com/minio/console/pkg/utils" @@ -482,15 +481,6 @@ func newAdminFromCreds(accessKey, secretKey, endpoint string, tlsEnabled bool) ( return minioClient, nil } -// httpClient is a custom http client, this client should not be called directly and instead be -// called using GetConsoleHTTPClient() to ensure is initialized and the certificates are loaded correctly -var httpClients = struct { - sync.Mutex - m map[string]*http.Client -}{ - m: make(map[string]*http.Client), -} - // isLocalAddress returns true if the url contains an IPv4/IPv6 hostname // that points to the local machine - FQDN are not supported func isLocalIPEndpoint(addr string) bool { @@ -520,17 +510,8 @@ func GetConsoleHTTPClient(address string, clientIP string) *http.Client { address = u.Hostname() } - httpClients.Lock() - client, ok := httpClients.m[address] - httpClients.Unlock() - if ok { - return client - } + client := PrepareConsoleHTTPClient(isLocalIPAddress(address), clientIP) - client = PrepareConsoleHTTPClient(isLocalIPAddress(address), clientIP) - httpClients.Lock() - httpClients.m[address] = client - httpClients.Unlock() return client }