Apache 2.4,mod_geoip GeoIPScanProxyHeaders“On”无法正常工作

apache httpd.conf

LoadModule geoip_module modules/mod_geoip.so <IfModule mod_geoip.c> GeoIPEnable On GeoIPEnableUTF8 On GeoIPOutput Env GeoIPScanProxyHeaders On GeoIPDBFile /usr/share/GeoIP/GeoIP.dat IndexCache </IfModule> 

HTTP请求:

 GET /test.php HTTP/1.1 Host: XXXXXXXXXXXXXXXXXXXXXXXX Connection: keep-alive X-Forwarded-For: 150.XX.XX.XXX 

testing页面/test.php

 <?php if( isset($_SERVER['GEOIP_COUNTRY_CODE']) ){ echo 'GEOIP_COUNTRY_CODE: '.$_SERVER['GEOIP_COUNTRY_CODE'].'<br>'; } if( isset($_SERVER['GEOIP_COUNTRY_NAME']) ){ echo 'GEOIP_COUNTRY_NAME: '.$_SERVER['GEOIP_COUNTRY_NAME'].'<br>'; } if( isset($_SERVER['GEOIP_ADDR']) ){ echo 'GEOIP_ADDR: '.$_SERVER['GEOIP_ADDR'].'<br>'; } if( isset($_SERVER['HTTP_X_FORWARDED_FOR']) ){ echo 'HTTP_X_FORWARDED_FOR: '.$_SERVER['HTTP_X_FORWARDED_FOR'].'<br>'; } echo 'REMOTE_ADDR: '.$_SERVER['REMOTE_ADDR'].'<br>'; 

产量

 GEOIP_COUNTRY_CODE: IT GEOIP_COUNTRY_NAME: Italy GEOIP_ADDR: 66.XX.XX.XXX HTTP_X_FORWARDED_FOR: 150.XX.XX.XXX REMOTE_ADDR: 66.XX.XX.XXX 

预期

 GEOIP_COUNTRY_CODE: US GEOIP_COUNTRY_NAME: United States GEOIP_ADDR: 150.XX.XX.XXX HTTP_X_FORWARDED_FOR: 150.XX.XX.XXX REMOTE_ADDR: 66.XX.XX.XXX 

mod_geoip似乎不使用HTTP_X_FORWARDED_FOR ipaddress …为什么?

 Server version: Apache/2.4.18 (Unix) Server built: Feb 4 2016 17:41:16 Loaded Modules: core_module (static) so_module (static) http_module (static) authn_file_module (shared) authn_core_module (shared) authz_host_module (shared) authz_groupfile_module (shared) authz_user_module (shared) authz_core_module (shared) access_compat_module (shared) auth_basic_module (shared) socache_shmcb_module (shared) reqtimeout_module (shared) filter_module (shared) substitute_module (shared) deflate_module (shared) mime_module (shared) log_config_module (shared) env_module (shared) expires_module (shared) headers_module (shared) setenvif_module (shared) version_module (shared) proxy_module (shared) proxy_connect_module (shared) proxy_ftp_module (shared) proxy_http_module (shared) proxy_fcgi_module (shared) proxy_scgi_module (shared) proxy_wstunnel_module (shared) proxy_ajp_module (shared) proxy_balancer_module (shared) proxy_express_module (shared) slotmem_shm_module (shared) lbmethod_byrequests_module (shared) lbmethod_bytraffic_module (shared) lbmethod_bybusyness_module (shared) lbmethod_heartbeat_module (shared) mpm_event_module (shared) unixd_module (shared) status_module (shared) autoindex_module (shared) negotiation_module (shared) dir_module (shared) actions_module (shared) alias_module (shared) rewrite_module (shared) geoip_module (shared) 

我怀疑我的geoip的版本是旧的

 $ dpkg -l | grep apache 

也许是

 ii libapache2-mod-geoip 1.2.8-2 amd64 GeoIP support for apache2