WPLocation

Country-aware content for WordPress

  • Features
  • Demo
  • Add-ons
  • Pricing
  • Blog
  • Account
  • Get WPLocation
← All documentation/Trusted proxy and visitor IP setup
Free + Pro

Trusted proxy and visitor IP setup

For the current website releases: Free 1.1.4 and Pro 1.4.0.

On this page
  1. Confirm the problem first
  2. Use the integration point only with a verified source
  3. Retest cache behavior
Free setupPro & licensingMy account & downloads

WPLocation reads the address the origin server presents as the client IP. On a site behind a CDN or reverse proxy, that may be the proxy address rather than the visitor address. Free does not automatically trust arbitrary forwarded headers because a direct client can forge them when the origin is reachable.

Confirm the problem first

  1. Check the database in WPLocation → Diagnostics with a known public IP address. This isolates the local country file from request routing.
  2. Compare the country result of a real public request with the country expected for the visitor’s network.
  3. Review the CDN or reverse proxy’s documented origin headers and verify that direct access to the origin is restricted or handled separately.

Use the integration point only with a verified source

The PHP filter wplocation_verified_client_ip receives the default client address and may return a replacement. A site-specific integration should use the proxy provider’s documented and authenticated forwarding mechanism, validate the result as an IP address, and return the original address if verification fails. Never blindly return the first value in X-Forwarded-For.

Deploy and test such code on staging with both direct-origin and proxied requests. Your hosting team may already set a trustworthy REMOTE_ADDR from the edge, in which case no filter is needed. This is a developer/hosting configuration, not a WPLocation Settings toggle.

Retest cache behavior

Correct IP detection alone does not fix a shared cache. A CDN can still reuse saved country-specific HTML. Follow Page cache and CDN safety and test allowed, denied and unknown results at the public URL.

Where to next?

Choose the right country rule →Check your cache and CDN →Browse all guides →
Need help with this guide?

Contact WPLocation with your software versions and the result you expected. Keep keys and customer data private.

Company

  • About us
  • Contact
  • Terms & Conditions
  • Privacy Policy

Product

  • Features
  • WPLocation Pro
  • Pricing
  • Add-ons roadmap
  • Get WPLocation

Resources

  • Blog
  • Documentation
  • Installation
  • Shortcodes
  • Changelog

Account & Support

  • My Account & Licenses
  • Contact Support
  • Blocked-content behavior

Copyright © 2026. WPLocation is a project of TechAbout LLC.
Questions? [email protected]