2

I am running Drupal 8.1.2 behind proxy in Ubuntu 16.04. There is an error:

Failed to get available update data for one project.

even the following is added in settings.ini:

$settings['http_client_config']['proxy']['http'] = '192.168.1.8:3128';
$settings['http_client_config']['proxy']['https'] = '192.168.1.8:3128';
$settings['http_client_config']['proxy']['no'] = ['127.0.0.1', 'localhost'];

I tried both 192.168.1.8:3128 and http://192.168.1.8:3128/ and neither works.

Both http_proxy and https_proxy work well in bash though.

How can I fix the error?

Update, with screenshot:

enter image description here

5
  • The error is for one project ...maybe you just have a custom/contrib module with dodgy packaging info and the proxy is actually working?
    – Clive
    Commented Jun 6, 2016 at 11:03
  • It's more than one project. I update the question with a screen shot.
    – ohho
    Commented Jun 7, 2016 at 1:03
  • That screenshot doesn't add any more information. That is still 1 project (drupal core) and all it's sub-modules. How many times have you tried running it? Sometimes a few may fail due to whatever networking related issues and then next time (or a couple of times later) they will work. If it always happens with the same project and it is reproducible every time you might have an issue.
    – rooby
    Commented Jun 7, 2016 at 2:06
  • The server is newly installed vanilla Drupal 8. It has been running for ~24 hours.
    – ohho
    Commented Jun 7, 2016 at 6:35
  • i have the same problem in D 8.4.2 behind corporate proxy. did u find any solution to this?
    – Gabbax0r
    Commented Nov 15, 2017 at 8:23

1 Answer 1

1

I solved the problem on Ubuntu 14.04.5 with Drupal 8.5.6. This should also work for Ubuntu 16.04.4. Install php7.0-curl (or php-curl or php5-curl or php7.2-curl) and write http:// before your proxy name (otherwise GuzzleHttp uses tcp://, I think).

Console/SSH

sudo apt update
# Use php --version to find out what version of PHP you're on
sudo apt install php7.0-curl
sudo service apache2 restart

Config

/var/www/html/<DRUPALFOLDER>/sites/default/settings.php

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

Optional

The old syntax is no longer necessary (but would not hurt either):

$settings['proxy_server'] = '192.168.1.8';  // HERE WITHOUT http:// !!!
$settings['proxy_port'] = 3128;
$settings['proxy_username'] = '';
$settings['proxy_password'] = '';
$settings['proxy_user_agent'] = '';
$settings['proxy_exceptions'] = array('127.0.0.1', 'localhost');

Console/SSH (again)

sudo service apache2 restart

For the Googlers: errors on my way

Show logs with

drush ws --count=100 --extended --tail
# or cd into `<DRUPALFOLDER>` and do
php drush.phar ws --count=100 --extended --tail

►►►

 *****  24/Aug **:**  update    error     GuzzleHttp\Exception\RequestException: Error creating resource: [message]
                                          fopen(http://updates.drupal.org/release-history/drupal/8.x?site_key=****************************
                                          ***************&version=8.5.6&list=**********************************************************...
                                          ...*************************************************************************): failed to open
                                          stream: Connection timed out
                                          [file] /var/www/html/******************/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
                                          [line] 324 in GuzzleHttp\Exception\RequestException::wrapException() (line 52 of
                                          /var/www/html/******************/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php).
 *****  24/Aug **:**  update    error     GuzzleHttp\Exception\RequestException: Error creating resource: [message]
                                          fopen(http://updates.drupal.org/release-history/admin_toolbar/8.x?site_key=*********************
                                          ***************************************&list=admin_toolbar%2Cadmin_toolbar_tools): failed to
                                          open stream: Connection timed out
                                          [file] /var/www/html/******************/vendor/guzzlehttp/guzzle/src/Handler/StreamHandler.php
                                          [line] 324 in GuzzleHttp\Exception\RequestException::wrapException() (line 52 of
                                          /var/www/html/******************/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php).

►►►

 *****  24/Aug **:**  notic  user  Session opened for ***.
                      e
 *****  24/Aug **:**  error  upda  GuzzleHttp\Exception\ClientException: Client error: `GET
                             te    http://updates.drupal.org/release-history/admin_toolbar/8.x?site_key=**********************************
                                   *********&version=8.x-1.24&list=admin_toolbar%2Cadmin_toolbar_tools` resulted in a `400 Bad Request`
                                   response:



 *****  24/Aug **:**  error  upda  GuzzleHttp\Exception\ClientException: Client error: `GET
                             te    http://updates.drupal.org/release-history/drupal/8.x?site_key=*****************************************
                                   **&version=8.5.6&list=******************************************************************************...
                                   ...***************************` resulted in a `400 Bad Request` response:
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.