Title: Error HTTP_X_FORWARDED
Last modified: August 20, 2016

---

# Error HTTP_X_FORWARDED

 *  Resolved [zookie_333](https://wordpress.org/support/users/zookie_333/)
 * (@zookie_333)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/error-http_x_forwarded/)
 * I have a problem when checkingout in my webshop. Website sends a “internal” ip(
   10.0.18.5) from isp and my payment gateway dont accept it.
 * My isp tells me to change this:
    $_SERVER[‘REMOTE_ADDRESS’] ===> $_SERVER[‘HTTP_X_REAL_IP’](
   not working)
 * My payment gateway tell me to change:
    return $tmp_ip;     ====> return $_SERVER[“
   HTTP_X_FORWARDED_FOR”];
 * My Code:
 *     ```
       /**
            * Returns the clients IP address.
            *
            * @return string
            */
           public function getClientIP() {
               //Proxy handling.
               $tmp_ip = $_SERVER['REMOTE_ADDR'];
               $x_fwd = isset($_SERVER["HTTP_X_FORWARDED_FOR"]) ? $_SERVER["HTTP_X_FORWARDED_FOR"] : null;
               if(self::$x_forwarded_for && $x_fwd !== null) {
                   //Cut out the first IP address
                   if(($cpos = strpos($x_fwd, ',')) !== false) {
                       $tmp_ip = substr($x_fwd, 0, $cpos);
                       $x_fwd = substr($x_fwd, $cpos+2);
                   }
                   else { //Only one IP address
                       $tmp_ip = $x_fwd;
                       $x_fwd = null;
                   }
               }
               $this->x_fwd = $x_fwd;
   
               return $tmp_ip;          
           }
       ```
   
 * HELP!!!!!!!!!!

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

 *  [webaware](https://wordpress.org/support/users/webaware/)
 * (@webaware)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/error-http_x_forwarded/#post-3537374)
 * Try adding this line to your wp-config.php file (before the require() statement):
 * `$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_REAL_IP'];`
 *  Thread Starter [zookie_333](https://wordpress.org/support/users/zookie_333/)
 * (@zookie_333)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/error-http_x_forwarded/#post-3537375)
 * Tnx. Now it works!
 *  Thread Starter [zookie_333](https://wordpress.org/support/users/zookie_333/)
 * (@zookie_333)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/error-http_x_forwarded/#post-3537376)
 * I made change it in the plugin file (payment gateway). Now it works perfect!
 * Thanks!
 *  [webaware](https://wordpress.org/support/users/webaware/)
 * (@webaware)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/error-http_x_forwarded/#post-3537377)
 * [@zookie_333](https://wordpress.org/support/users/zookie_333/): is the payment
   gateway your own? If not, you will lose your changes when you update — which 
   is why I suggested the wp-config.php file instead.

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

The topic ‘Error HTTP_X_FORWARDED’ is closed to new replies.

## Tags

 * [HTTP](https://wordpress.org/support/topic-tag/http/)
 * [IP](https://wordpress.org/support/topic-tag/ip/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [webaware](https://wordpress.org/support/users/webaware/)
 * Last activity: [13 years, 2 months ago](https://wordpress.org/support/topic/error-http_x_forwarded/#post-3537377)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
