diff --git a/references/config.md b/references/config.md index a09d1f39..a7489048 100644 --- a/references/config.md +++ b/references/config.md @@ -389,3 +389,160 @@ To set the same environment variable value for every shell session, you’ll nee # Always use vim to edit a post export EDITOR=vim + +## HTTP proxy configuration + +If you're working in an environment that requires HTTP requests to be made through a proxy server, you can configure proxy support for both WordPress core HTTP requests and WP-CLI's own HTTP requests. + +While php-curl honors the `HTTP_PROXY` environment variable automatically, neither WordPress's HTTP API nor WP-CLI's HTTP request functionality automatically trust the `HTTP_PROXY` environment variable for security reasons. However, you can manually configure proxy support using the `require` configuration option in `wp-cli.yml`. + +### Configuring proxy for WordPress core HTTP requests + +Create a proxy configuration PHP file that reads the proxy settings from environment variables and defines the appropriate WordPress constants: + +**wp-cli.yml:** +```yaml +require: + - proxy.php +``` + +**proxy.php:** +```php +