Search
Close this search box.

Documentation

In this article

Category:

Categories

Recent articles

Overriding the GEO IP header

Complianz contains GEO IP functionality to display the ‘correct’ type of Cookie Banner, either opt-in or opt-out, based on the region from which a visitor reaches your website.

If your site is behind a DDoS protection service such as CloudFlare, that service will be forwarding the traffic to your site. This means that the requests are received from that protection service, and the IP address would be stored in a different ‘header’.

Complianz’ GEO IP implementation will check the following header values (from top to bottom), and if the one being checked either does not exist or equals ‘127.0.0.1’, it moves on to the next one:

  • ‘HTTP_CF_CONNECTING_IP’,
  • ‘CF-IPCountry’,
  • ‘HTTP_TRUE_CLIENT_IP’,
  • ‘HTTP_X_CLUSTER_CLIENT_IP’,
  • ‘HTTP_CLIENT_IP’,
  • ‘HTTP_X_FORWARDED_FOR’,
  • ‘HTTP_X_FORWARDED’,
  • ‘HTTP_X_REAL_IP’,
  • ‘HTTP_FORWARDED_FOR’,
  • ‘HTTP_FORWARDED’,
  • ‘REMOTE_ADDR’

You can override the header that Complianz checks with the below filter, in case your set-up requires this:

Change HTTP_FORWARDED_FOR on line 3 to the header that Complianz should check for the IP address.

Join 900.000 users and install The Privacy Suite for WordPress locally, automated or fully customized, and access our awesome support if you need any help!

Complianz has received its Google CMP Certification to conform to requirements for publishers using Google advertising products.