Drupal::httpClient() and proxy settings I've defined a proxy in my settings.php:

$settings['http_client_config']['proxy']['http'] = 'http://ip:port';
$settings['http_client_config']['proxy']['https'] = 'http://ip:port';
$settings['http_client_config']['proxy']['no'] = ['127.0.0.1', 'localhost'];


In real I've replaced ip and port with nummeric values. 

In a custom module I've defined:

$client = \Drupal::httpClient();
//$request = $client-&gt;get($this-&gt;source_url.'service=wms&amp;request=getcapabilities');


These works, when Im not behind a proxy. How, can I add the proxy settings to this request?

$set =\Drupal\Core\Site\Settings::get('http_client_config');
$proxy = $set['proxy'];
//Get GetCapabilies.
$client = \Drupal::httpClient();
$request = $client-&gt;get($this-&gt;source_url.'service=wms&amp;request=getcapabilities');


I don't find any way to add the 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);