Problem/Motivation
Our search server is on a dedicated Linux VM that is on the same corporate network as the Drupal sites it serves. No proxy is used to instantiate communication between the search server and those site.
In our settings.php file, we've adjusted $settings['http_client_config']['proxy']['no'] = ['127.0.0.1', 'localhost']; to include the search server (both hostname and IP address). However, the Elastic Connector does not appear to leverage this setting.
Proposed resolution
As a test, we modified src/ElasticSearch/ClientManager.php as follows:
'curl' => [
CURLOPT_CONNECTTIMEOUT => (!empty($cluster->options['timeout']) ? $cluster->options['timeout'] : Cluster::ELASTICSEARCH_CONNECTOR_DEFAULT_TIMEOUT),
CURLOPT_PROXY => '',
],
which effectively stopped Curl from leveraging the system proxy.
The test worked, and the connector was able to communicate with the search server!
However, this is a crude fix. I would ask you to consider adjusting the getClientForCluster function so that it checks the ['http_client_config']['proxy']['no'] array, and disables the proxy for hosts in that list.
Comments
Comment #2
charlesj commentedComment #3
agoja commentedHello @charlesj,
You could take a look at:
hook_elasticsearch_connector_load_library_options_alter(array &$options, \Drupal\elasticsearch_connector\Entity\Cluster $cluster)This hook will provide you possibility to alter the $options array used for connection.
Regards.