Skip to content

test(wp-compat): check the proxy notice behind a real reverse proxy - #114

Open
cport1 wants to merge 1 commit into
mainfrom
test/wp-compat-proxy
Open

cport1 wants to merge 1 commit into
mainfrom
test/wp-compat-proxy

Conversation

@cport1

@cport1 cport1 commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Adds tests/wp-compat/proxy.sh, which puts an nginx reverse proxy in front of the throwaway WordPress site and checks the "behind a proxy it has not been told about" notice. It's the regression test for the bugs fixed in 2.10.5 (#113).

What it checks

Setup Expected
Direct, no proxy no notice
Proxy the host already resolves: REMOTE_ADDR is the visitor and X-Forwarded-For is still passed, as on WordPress.com no notice
Unresolved proxy: REMOTE_ADDR is the proxy notice shows, and its button opens the settings page at the trusted-proxies field
Proxy configured as trusted no notice

Note on the harness

The official wordpress image ships mod_remoteip turned on, trusting private address ranges. So the harness already behaves like a host that resolves the visitor. For the unresolved case the script turns the module and its config off, and an exit handler turns them back on.

The config is validated before each reload. Disabling only the module leaves an invalid config, and Apache's graceful reload then silently keeps the old config running.

Results

  • 2.10.4 fails on the false notice and on the button returning a 403 from page=webdecoy-settings, the two bugs reported.
  • 2.10.5: PROXY OK.
  • smoke.sh still ends with SMOKE OK with the new proxy service in the compose file.
cd tests/wp-compat
docker compose up -d db wp proxy && bash proxy.sh

proxy.sh puts nginx in front of the throwaway site and checks the "behind a
proxy it has not been told about" notice four ways: direct; through a proxy
the host resolves (REMOTE_ADDR is the visitor, X-Forwarded-For still passed,
as on WordPress.com); through an unresolved proxy, where the notice must show
and its button must open the trusted-proxies field; and with the proxy
trusted.

The official wordpress image ships mod_remoteip on, trusting private ranges,
so the harness is a resolving host out of the box; the unresolved case turns
the module and its conf off (validated before reload, since a broken config
makes graceful silently keep the old one) and the EXIT trap restores them.

2.10.4 fails it on the false notice and the button's 403; 2.10.5 passes.
smoke.sh still passes with the proxy service in the compose file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant