-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
It looks like wp-cli completely ignores proxy settings.
We've tried different ways of configuration, like global or local yaml file, via environment variables, via wodpress config, via CLI.
The proxy is already set in wp-config.php and seems to work fine so far except with wp-cli.
Setting those options e.g. by --requires=/path/to/additional-php-stuff.php emits a warning about the constants already being defined but doesn't seem to help anyway.
So no luck either.
We tried environment variables like the common "http_proxy" as well as WP_PROXY_HOST / WP_PROXY_PORT as well as defining those in the mentioned PHP file, WP config, YAML files.
Steps to reproduce:
- Have a VM, container or whatever and disable internet communication by firewall
- Have a working proxy
- Try e.g. curl against google or wordpress.org using your proxy:
curl -s --proxy proxy.example.com:3128 https://downloads.wordpress.org -o /dev/null - You may also run a
tcpdump -ni any port 443while you try to run "wp core update", "wp cli check-update" or whatever else does external HTTP requests - Get errors about running into timeout (in case the firewall just drops, instead of reject)
Error: Failed to get url 'https://api.github.com/repos/wp-cli/wp-cli/releases?per_page=100': cURL error 28: Failed to connect to api.github.com port 443 after 10000 ms: Timeout was reached.Error: Failed to get url 'https://downloads.wordpress.org/release/wordpress-6.9-no-content.zip': cURL error 28: Failed to connect to downloads.wordpress.org port 443 after 10000 ms: Timeout was reached.- Notice traffic on the above tcpdump triggered by "wp"
wp cli doesn't use the proxy at all it seems. wp core update seems to, kinda, but somehow mixes up requests via proxy and without it. Like I can see requests to api.wordpress.org via proxy which work and those to the actual download are made without the proxy.
OS: Linux 6.1.0-41-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.158-1 (2025-11-09) x86_64
Shell: /usr/sbin/nologin
PHP binary: /usr/bin/php8.2
PHP version: 8.2.29
php.ini used: /etc/php/8.2/cli/php.ini
MySQL binary: /usr/bin/mysql
MySQL version: mysql Ver 8.0.44 for Linux on x86_64 (MySQL Community Server - GPL)
SQL modes:
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir: phar://wp-cli.phar/vendor
WP_CLI phar path: /var/www/example/wordpress
WP-CLI packages dir: /var/www/.wp-cli/packages/
WP-CLI cache dir: /var/www/.wp-cli/cache
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 2.11.0
php-curl is also installed.
No suhosin. No wp packages installed.