Add HTTP proxy configuration example

未关闭
#601 18 条评论 2 个 reaction 已指派 2 人 在 GitHub 查看

维护者通常 1 天内回复

@swissspidy 已经在做这个了。

开始于 2026年2月3日。

  • #623 来自 @copilot-swe-agent —— 已关闭,未合并
  • #636 来自 @yusufhay —— 已关闭,未合并
  • #654 来自 @swissspidy —— 已关闭,未合并
  • #658 来自 @dilipom13 —— 未关闭

评估

这个 Issue 还没有评估数据。

描述

scope:documentation

Split out from https://github.com/wp-cli/core-command/issues/292

  • php-curl happens to honor the http_proxy env var
  • Requests defers honoring that env var to the library user (e.g., WordPress core or WP-CLI) (see also https://github.com/WordPress/Requests/issues/218)
  • WP-CLI doesn't want to blindly trust that env var
  • One should be able to manually configure proxy support via wp-cli.yml and the extra-php config

You might be able to do something like this:

# In wp-cli.yml
require:
  - path-to/proxy.php
// proxy.php

$proxy_host = getenv( 'HTTP_PROXY' );

if ( ! $proxy_host ) {
	return;
}

$proxy_url = parse_url( $proxy_host );

if ( $proxy_url['host'] ) {
	define( 'WP_PROXY_HOST', $proxy_url['host'] );
}

if ( $proxy_url['port'] ) {
	define( 'WP_PROXY_PORT', $proxy_url['port'] );
}

This would configure the proxy for HTTP requests in core when using WP-CLI, similar to when you define this in wp-config.php. The setup would be slightly more complex for modifying HTTP requests from WP-CLI itself.

主要语言
PHP
星标
205
派生
377
平均合并
3 天 1 小时
30 天内合并 PR
10

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。