Docs

CDN Proxy and Visitor IP

1 min readUpdated October 19, 2026

Behind a CDN or proxy (Cloudflare, Bunny, CloudFront, Sucuri, Fastly and others), your server sees the CDN’s address instead of the visitor’s. Without the real address, a location lookup would find the CDN’s country, not the visitor’s.

Visitor IP address setting#

Go to WooCommerce > Smart Phone Field > Location > Visitor IP address.

  • Automatic (default): reads the visitor’s real IP from the CDN’s or proxy’s header, then falls back to the server connection.
  • Server connection only: ignores those headers. Use this if your site isn’t behind a CDN or proxy, so visitors can’t send a made-up header.
A settings interface for visitor location detection. It features a toggle for “Detect visitor location” set to on, followed by dropdown menus for “Detection method,” “Backup API,” “freeipapi.com plan,” and “Visitor IP address,” each with descriptive text underneath.

Skip the lookup completely#

If your CDN or host adds a country header, choose CDN or hosting headers as the Detection method. The country is read straight from the header, with no outside call. Headers from Cloudflare, Bunny, CloudFront, Vercel, CDN77, Sucuri and server GeoIP are supported. On Cloudflare, make sure IP Geolocation is on.

Every visitor gets the same country?#

You’re probably behind a proxy. Set Visitor IP address to Automatic, or switch to CDN or hosting headers. If that doesn’t help, ask your host to pass the real visitor IP through.

In code#

  • nahnu_spf_client_ip_headers lists the request headers that carry the real visitor IP, most specific first.
  • nahnu_spf_cdn_country_headers and nahnu_spf_cdn_state_headers list the headers read for the country and state.

This website uses cookies to enhance your browsing experience and ensure the site functions properly. By continuing to use this site, you acknowledge and accept our use of cookies.

Accept All Accept Required Only