Skip to content

Document HTTP proxy configuration for WP-CLI and WordPress core - #658

Open
dilipom13 wants to merge 3 commits into
wp-cli:mainfrom
dilipom13:fix/601-http-proxy-docs
Open

dilipom13 wants to merge 3 commits into
wp-cli:mainfrom
dilipom13:fix/601-http-proxy-docs

Conversation

@dilipom13

@dilipom13 dilipom13 commented Aug 2, 2026 •

Copy link
Copy Markdown

Fixes #601

Adds HTTP proxy configuration documentation for WP-CLI and WordPress core requests.

  • New guide: guides/http-proxy.md
  • Recommends ekamran/wp-cli-http-proxy-command package
  • Includes manual fallback for WordPress core-only proxy setup
  • Updates manifest, index, guides list, and cross-links in config/troubleshooting docs

Summary by CodeRabbit

  • Documentation
    • Added an HTTP Proxy Configuration guide covering proxy setup for WP-CLI and WordPress core, including installation, YAML configuration, authentication, bypass hosts, diagnostics, limitations, and manual core configuration.
    • Added links to the guide throughout the handbook, guides index, troubleshooting content, and configuration references.
    • Clarified that WP-CLI does not automatically use HTTP_PROXY or HTTPS_PROXY environment variables.

@dilipom13
dilipom13 requested a review from a team as a code owner August 2, 2026 07:38
@coderabbitai

coderabbitai Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0a94c65d-ecfa-4c89-b7b8-e012f8ad0475
Commits

Reviewing files that changed from the base of the PR and between 125b9fe and 6806b75.

Files selected for processing: 3
  • bin/handbook-manifest.json
  • guides.md
  • guides/troubleshooting.md
Files skipped from review as they are similar to previous changes: 2
  • guides.md
  • guides/troubleshooting.md

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

Added HTTP proxy configuration guidance for WP-CLI and WordPress core requests. The guide covers package-based setup and manual proxy constants. Related handbook pages now link to the guide.

Changes: HTTP proxy documentation

Layer / File(s) Summary
Proxy configuration guidance
guides/http-proxy.md, guides/troubleshooting.md, references/config.md
Added package-based and manual proxy setup guidance. The guide covers authentication, bypass hosts, environment variables, diagnostics, disabling, and limitations. Troubleshooting and configuration references link to the guide.
Guide navigation and manifest wiring
bin/handbook-manifest.json, guides.md, index.md
Registered the HTTP Proxy Configuration guide and added links to it from handbook navigation pages.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other

Suggested reviewers: swissspidy, ekamran

Merge Risk: Low · up to 6806b

Users may expect package installation and updates to use the proxy; narrow the guide’s coverage claims to avoid failed or confusing setup behind a proxy.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: documenting HTTP proxy configuration for WP-CLI and WordPress core.
Linked Issues check Passed Issue #601 requests documentation for HTTP proxy configuration, including manual setup through wp-cli.yml and extra-php. guides/http-proxy.md provides both methods. It also explains that the man…
Out of Scope Changes check Passed The changes stay within issue #601. The new guide, manifest entry, index links, configuration cross-link, and troubleshooting cross-link support discovery and use of the HTTP proxy configuration. No u…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Full details: Linked Issues check

Explanation

Issue #601 requests documentation for HTTP proxy configuration, including manual setup through wp-cli.yml and extra-php. guides/http-proxy.md provides both methods. It also explains that the manual method configures WordPress core requests and does not configure WP-CLI requests. The guide documents a package for full WP-CLI and core support. The manifest and guide indexes publish the new guide.

Full details: Out of Scope Changes check

Explanation

The changes stay within issue #601. The new guide, manifest entry, index links, configuration cross-link, and troubleshooting cross-link support discovery and use of the HTTP proxy configuration. No unrelated product code or behavior changes are present.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 0 files. (3 skipped: 3 unsupported.)

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@guides/http-proxy.md`:
- Around line 160-165: Update the configuration instructions near the
require-based setup to also document the extra-php fallback, including a short
wp config create --extra-php example or its scope and timing limitations.
- Around line 49-61: Add a prominent warning near the http-proxy YAML example
that proxy credentials, especially the password, must not be committed to
project configuration or source control. Recommend using an untracked
configuration file with restrictive permissions or injecting credentials through
a secret-management mechanism.
- Around line 63-77: Update the “Using Environment Variables” section to state
that env: true selects the first non-empty variable from HTTPS_PROXY,
https_proxy, HTTP_PROXY, and http_proxy, then applies one global proxy rather
than per-scheme proxies or bypass rules. Explicitly document that NO_PROXY and
no_proxy are unsupported, distinguish this behavior from libcurl, and explain
that callers needing bypasses should map NO_PROXY entries to bypass-hosts.
- Around line 147-152: Update the proxy credential handling around
WP_PROXY_USERNAME and WP_PROXY_PASSWORD to URL-decode the parsed username and
password values before defining the constants, while preserving the existing
empty-value checks and constant definitions.
- Around line 135-145: Update the proxy configuration flow after parse_url to
require a valid proxy port, deriving one when appropriate if the URL omits it,
before defining WP_PROXY_HOST. Ensure WP_PROXY_PORT is always defined alongside
WP_PROXY_HOST so WordPress proxy support is enabled only with a valid host and
port.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: a6f322d6-32ab-41ec-be2f-8a63dcc95484

📥 Commits

Reviewing files that changed from the base of the PR and between 5e521dc and 253b3be.

📒 Files selected for processing (6)
  • bin/handbook-manifest.json
  • guides.md
  • guides/http-proxy.md
  • guides/troubleshooting.md
  • index.md
  • references/config.md

Comment thread guides/http-proxy.md Resolved
Comment thread guides/http-proxy.md Resolved
Comment thread guides/http-proxy.md Resolved
Comment thread guides/http-proxy.md Resolved
Comment thread guides/http-proxy.md Resolved
@swissspidy

Copy link
Copy Markdown
Member

See also #654

@dilipom13

Copy link
Copy Markdown
Author

See also #654

Thanks @swissspidy for pointing to #654. Happy to combine efforts , please let me know
which PR you'd like to use as the base, and I'll align my changes accordingly.

Clarify credential handling, env var behavior, port requirements, URL-decoded auth values, and the extra-php fallback option.

Copy link
Copy Markdown
Member

@dilipom13 Thanks for your patience, and sorry for the slow reply.

Let's go with this PR as the base — I've closed #654, so no need to port your changes anywhere. If anything from that branch is worth keeping, feel free to pull it in here; otherwise this can proceed as is.


Generated by Claude Code

@ekamran ekamran left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for writing this up. I maintain the package, so I checked the guide against its current release, v0.1.0. Three small fixes inline so the guide matches what the package does.

Comment thread guides/http-proxy.md

## Using the HTTP Proxy Package (Recommended)

The [`ekamran/wp-cli-http-proxy-command`](https://github.com/ekamran/wp-cli-http-proxy-command) community package provides complete proxy support for both WP-CLI's internal HTTP requests (e.g. package management, updates) and WordPress core HTTP requests.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wp package commands go through Composer, so the package does not cover them. The Limitations section below says the same. Suggest naming what it does cover:

Suggested change
The [`ekamran/wp-cli-http-proxy-command`](https://github.com/ekamran/wp-cli-http-proxy-command) community package provides complete proxy support for both WP-CLI's internal HTTP requests (e.g. package management, updates) and WordPress core HTTP requests.
The [`ekamran/wp-cli-http-proxy-command`](https://github.com/ekamran/wp-cli-http-proxy-command) community package configures the proxy for both WordPress core HTTP requests and WP-CLI's own HTTP requests made through `WP_CLI\Utils\http_request()`, such as `wp core verify-checksums`.

Comment thread guides/http-proxy.md
Install the package using the `wp package install` command:

```bash
wp package install ekamran/wp-cli-http-proxy-command

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On WP-CLI 2.12.0 the bare name installs dev-main. :@stable installs the latest release (v0.1.0), as the package README recommends.

Suggested change
wp package install ekamran/wp-cli-http-proxy-command
wp package install ekamran/wp-cli-http-proxy-command:@stable

Comment thread guides/http-proxy.md

This `extra-php` approach only applies to the generated `wp-config.php` at install time. It does not configure WP-CLI's own HTTP requests and is not suitable for existing installs unless you add the constants manually.

> Note: This manual approach sets the constants used by WordPress core HTTP requests after WordPress loads, but does not automatically route WP-CLI's pre-bootstrap or standalone HTTP requests (such as `wp package` commands). For complete proxy coverage across all WP-CLI operations, use the [`ekamran/wp-cli-http-proxy-command`](https://github.com/ekamran/wp-cli-http-proxy-command) package.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package does not cover wp package commands either, so "complete proxy coverage across all WP-CLI operations" overstates it.

Suggested change
> Note: This manual approach sets the constants used by WordPress core HTTP requests after WordPress loads, but does not automatically route WP-CLI's pre-bootstrap or standalone HTTP requests (such as `wp package` commands). For complete proxy coverage across all WP-CLI operations, use the [`ekamran/wp-cli-http-proxy-command`](https://github.com/ekamran/wp-cli-http-proxy-command) package.
> Note: This manual approach only defines the constants that WordPress core uses for its own HTTP requests. WP-CLI's own HTTP requests do not use them. To route those through the proxy as well, use the [`ekamran/wp-cli-http-proxy-command`](https://github.com/ekamran/wp-cli-http-proxy-command) package. Neither approach covers `wp package` commands (see Limitations above).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add HTTP proxy configuration example

4 participants