[Website] Preserve plugin proxy default response headers#4157
Merged
brandonpayton merged 4 commits intoJul 24, 2026
Conversation
ashfame
marked this pull request as ready for review
July 23, 2026 15:37
## What changed Remove the standalone `$pluginResponse;` expression from `plugin-proxy.php`. ## Why The variable is never assigned or read, and it has no declaration or control-flow effect in PHP. The statement was introduced in 2023 with the Gutenberg pull-request preview flow and has remained unused. Evaluating the undefined variable can emit a warning even though `display_errors` hides it from the HTTP response. ## Impact There is no intended behavior change. The cleanup removes a no-op expression and avoids a possible undefined-variable warning in server logs. ## Stack This PR is stacked on #4157 and targets its head branch. It should be merged after #4157, which is itself stacked on #4137. ## Validation - Focused plugin-proxy Playwright suite: 7 passed - Website lint: passed - PHP syntax check: passed
brandonpayton
requested changes
Jul 23, 2026
brandonpayton
left a comment
Member
There was a problem hiding this comment.
@ashfame thank you for catching this. I left some comments and will have Codex work on them.
Cover both filtered and forwarded Content-Type behavior and document why the PHP and TypeScript test routers are needed.
brandonpayton
merged commit Jul 24, 2026
6c63ae8
into
emdash/plugin-proxy-redirect-hardening-prp48
101 of 103 checks passed
brandonpayton
added a commit
that referenced
this pull request
Jul 24, 2026
## What changed This stacked PR adds regression coverage for filtered upstream response headers and preserves configured default response headers when a same-named upstream header is filtered out. ## Why PR #4137 buffers response headers while following redirects. The new helper marked every received header as seen before applying the response-header allowlist. A filtered upstream `Content-Type` therefore suppressed the configured `Content-Type: application/zip` fallback even though neither header reached the client. The fix records a response header as seen only after it passes the allowlist and is forwarded. ## Impact Plugin, theme, release, and artifact downloads retain their intended ZIP content type and download metadata when upstream headers are filtered. ## Commit and CI sequence 1. Commit `7161ff666` added the regression test only. [Chromium shard 2 failed](https://github.com/WordPress/wordpress-playground/actions/runs/30019151059/job/89246998902) with `Expected: "application/zip"` and `Received: undefined`. 2. Commit `75c40e2b5` applied the one-line production fix. [The same Chromium shard passed](https://github.com/WordPress/wordpress-playground/actions/runs/30020038612/job/89250060487), including `keeps a default header when the matching upstream header is filtered`. This PR is stacked on #4137 and targets its head branch. ## Validation - Focused Playwright suite after the fix: 7 passed - Website lint: passed - PHP syntax checks for `plugin-proxy.php` and the test router: passed - GitHub Actions regression test: failed before the fix and passed after the fix --------- Co-authored-by: Brandon Payton <brandon@happycode.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
This stacked PR adds regression coverage for filtered upstream response headers and preserves configured default response headers when a same-named upstream header is filtered out.
Why
PR #4137 buffers response headers while following redirects. The new helper marked every received header as seen before applying the response-header allowlist. A filtered upstream
Content-Typetherefore suppressed the configuredContent-Type: application/zipfallback even though neither header reached the client.The fix records a response header as seen only after it passes the allowlist and is forwarded.
Impact
Plugin, theme, release, and artifact downloads retain their intended ZIP content type and download metadata when upstream headers are filtered.
Commit and CI sequence
7161ff666added the regression test only. Chromium shard 2 failed withExpected: "application/zip"andReceived: undefined.75c40e2b5applied the one-line production fix. The same Chromium shard passed, includingkeeps a default header when the matching upstream header is filtered.This PR is stacked on #4137 and targets its head branch.
Validation
plugin-proxy.phpand the test router: passed