php-ews icon indicating copy to clipboard operation
php-ews copied to clipboard

proxy settings comes not to guzzle

Open fglueck opened this issue 5 years ago • 1 comments

if I call

$opt = ['version'        => 'Exchange2013'
              , 'MailboxCulture' => 'de-DE'
              , 'timezone'       => 'W. Europe Standard Time'              
              , 'proxy'          => [
                  'http'  => 'tcp://proxycluster.xxx.xx:80', 
                  'https' => 'tcp://proxycluster.xxx.xx:80',
               ]
 API::withUsernameAndPassword(..., ..., $opt)

the proxy settings will not used or path through to guzzle, I must patch guzzlehttp\guzzle\src\Client.php

    private function configureDefaults(array $config)
    {
        $defaults = [
            'allow_redirects' => RedirectMiddleware::$defaultSettings,
            'http_errors'     => true,
            'decode_content'  => true,
            'verify'          => true,
            'cookies'         => false,
            'idn_conversion'  => true,
          'proxy'          => [
                'http'  => 'tcp://proxycluster.xxx.xx:80', 
                'https' => 'tcp://proxycluster.xxx.xx:80',
          ]
        ];

Is this the only way to use a proxy or is there any trick for using a proxy without manipulating sources?

fglueck avatar Sep 29 '20 09:09 fglueck

Hi,

you can add this to options:

$options['httpPlayback']['proxy']['http'] = 'http://proxyhost:8080';
$options['httpPlayback']['proxy']['https'] = 'http://proxyhost:8080';

API::withUsernameAndPassword($endPoint, $userName, $password, $options),

pnlarsson avatar Feb 22 '21 09:02 pnlarsson