WordPress.org

Make WordPress Core

Ticket #9235: 9235.3.diff

File 9235.3.diff, 1.1 KB (added by Denis-de-Bernardy, 6 years ago)
  • wp-settings.php

     
    105105if ( empty($PHP_SELF) ) 
    106106        $_SERVER['PHP_SELF'] = $PHP_SELF = preg_replace("/(\?.*)?$/",'',$_SERVER["REQUEST_URI"]); 
    107107 
     108/** 
     109 * Fix remote address behind a load balancer 
     110 * 
     111 * If what follows doesn't work with your setup, configure the define in your wp-config.php file 
     112 * 
     113 * @since 2.9 
     114 */ 
     115if ( defined('WP_REMOTE_ADDR') ) { 
     116        $_SERVER['REMOTE_ADDR'] = WP_REMOTE_ADDR; 
     117} elseif ( isset($_SERVER['HTTP_X_FORWARDED_FOR']) ) { 
     118        // this one can have multiple IPs separated by a coma  
     119        $_SERVER['REMOTE_ADDR'] = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);  
     120        $_SERVER['REMOTE_ADDR'] = $_SERVER['REMOTE_ADDR'][0];  
     121} elseif ( isset($_SERVER['HTTP_X_REAL_IP']) ) { 
     122        $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_REAL_IP'];  
     123} 
     124 
    108125if ( version_compare( '4.3', phpversion(), '>' ) ) { 
    109126        die( sprintf( /*WP_I18N_OLD_PHP*/'Your server is running PHP version %s but WordPress requires at least 4.3.'/*/WP_I18N_OLD_PHP*/, phpversion() ) ); 
    110127}