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->get($this->source_url.'service=wms&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->get($this->source_url.'service=wms&request=getcapabilities');
I don't find any way to add the proxy settings.
$client
is a Guzzle client, so you can use its standard methods: docs.guzzlephp.org/en/stable/request-options.html#proxy