Title: Cloudflare problem
Last modified: January 19, 2021

---

# Cloudflare problem

 *  [anamferreira](https://wordpress.org/support/users/anamferreira/)
 * (@anamferreira)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/cloudflare-problem-4/)
 * Hi, I have a problem with cloudflare and the plugin, the IP addresses that the
   plugin blocks are those of cloudflare and not those of the client user. What 
   is the cause of that?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [anamferreira](https://wordpress.org/support/users/anamferreira/)
 * (@anamferreira)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/cloudflare-problem-4/#post-13928572)
 * [https://i.ibb.co/W28cBvM/01.png](https://i.ibb.co/W28cBvM/01.png)
 *  Plugin Author [iSaumya](https://wordpress.org/support/users/isaumya/)
 * (@isaumya)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/cloudflare-problem-4/#post-13931228)
 * Cause that’s what present in the server header when using Cloudflare.
 * Check the `visitor_ip()` function
 *     ```
       public function visitor_ip() {
         $ipArr = array();
   
         foreach ( array( 'HTTP_CF_CONNECTING_IP', 'HTTP_X_ORIGINATING_IP', 'HTTP_X_REMOTE_IP', 'HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR' ) as $key ) {
           if ( array_key_exists( $key, $_SERVER ) === true ) {
             foreach ( explode( ',', $_SERVER[$key] ) as $ip ) {
               $ip = trim( $ip ); // just to be safe
   
               if ( filter_var( $ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) !== false ) {
                 array_push($ipArr, $ip);
                 //return $ip;
               }
             }
           }
         }
   
         $currentIP = '';
         $actualIP = '';
   
         foreach ($ipArr as $ip) {
           if($ip !== $_SERVER['SERVER_ADDR']) {
             if($currentIP !== $ip) {
               $currentIP = $ip;
               $actualIP = $ip;
             } 
           }
         }
   
         return $actualIP;
       }
       ```
   

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Cloudflare problem’ is closed to new replies.

 * ![](https://ps.w.org/ad-invalid-click-protector/assets/icon-256x256.png?rev=1534940)
 * [Ad Invalid Click Protector (AICP)](https://wordpress.org/plugins/ad-invalid-click-protector/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ad-invalid-click-protector/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ad-invalid-click-protector/)
 * [Active Topics](https://wordpress.org/support/plugin/ad-invalid-click-protector/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ad-invalid-click-protector/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ad-invalid-click-protector/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [iSaumya](https://wordpress.org/support/users/isaumya/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/cloudflare-problem-4/#post-13931228)
 * Status: not resolved