Drupal::httpClient() and proxy settings
You can pass all http client config to the "client factory". You can also include your own custom settings.     

$settings = \Drupal::service('settings');
$clientConfig = $settings-&gt;get('http_client_config') ?? [];
$client = \Drupal::service('http_client_factory')
                   -&gt;fromOptions($clientConfig);