Skip to content

fix: false 'behind a proxy' notice on managed hosts, broken notice button; release 2.10.5 - #113

Merged
cport1 merged 2 commits into
mainfrom
fix/proxy-notice-false-positive
Oct 5, 2026
Merged

cport1 merged 2 commits into
mainfrom
fix/proxy-notice-false-positive

Conversation

@cport1

@cport1 cport1 commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Problem

Every new install, including WordPress.com, showed "WebDecoy is not blocking: this site is behind a proxy it has not been told about", and the notice's Configure trusted proxies button led to WordPress's "Sorry, you are not allowed to access this page."

Causes

  1. False positive. maybe_flag_proxy() set the flag whenever an admin request carried any forwarding header. Hosts that rewrite REMOTE_ADDR to the visitor (WordPress.com, nginx real_ip, Apache mod_remoteip) still pass X-Forwarded-For along. On those hosts every visitor already has their own address, but the plugin withheld enforcement anyway.
  2. Broken link. The state notices linked to admin.php?page=webdecoy-settings, which isn't a registered page. The settings page slug is webdecoy.

Fix

  • New WebDecoy_Blocker::unresolved_forwarding_header() flags only when REMOTE_ADDR is absent from every forwarded address. It parses X-Forwarded-For lists, RFC 7239 Forwarded: for=, ports, brackets and IPv6, and compares canonical forms. maybe_flag_proxy() uses it.
  • The signal is still sampled only from an administrator's own request, so a visitor can't switch enforcement off with a forged header. Existing false flags clear on the next admin page load.
  • Both notice buttons now go to admin.php?page=webdecoy, and the proxy button is anchored to #webdecoy_trusted_proxies.

Release

The second commit bumps to 2.10.5 (webdecoy.php, readme.txt, changelog.txt, cdn-files/plugin-info.json).

Testing

  • tests/ProxyDetectionTest.php covers 9 cases: hosts that resolved the address (XFF single and chain, CF, Forwarded with IPv6 and port, IPv4 with port), unresolved XFF and CF, and a junk header value.
  • php tests/run.php: 205 passed, 0 failed.
  • PHPStan: no errors. phpcs: no new findings.
  • Not yet checked on a live WordPress.com site.

cport1 added 2 commits October 4, 2026 21:50
…isitor

The "not blocking: behind a proxy it has not been told about" notice fired on
any admin request carrying a forwarding header. Managed hosts (WordPress.com,
nginx real_ip, Apache mod_remoteip) rewrite REMOTE_ADDR to the visitor and
still pass X-Forwarded-For along, so nearly every install saw the notice, and
enforcement was withheld on sites where every visitor already had their own
address.

maybe_flag_proxy() now uses WebDecoy_Blocker::unresolved_forwarding_header(),
which flags only when REMOTE_ADDR is absent from every forwarded address
(X-Forwarded-For lists, RFC 7239 Forwarded, ports, brackets, IPv6). The
signal is still sampled from an administrator's request only, so a visitor
cannot switch enforcement off with a forged header. Stale flags clear on the
next admin page load.

The notice's "Configure trusted proxies" button (and the monitor-mode
button) linked to page=webdecoy-settings, which does not exist; the settings
page slug is "webdecoy". It now goes there, anchored to the field.
@cport1
cport1 merged commit a4f4eea into main Oct 5, 2026
4 checks passed
@cport1
cport1 deleted the fix/proxy-notice-false-positive branch October 5, 2026 02:52
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