Hi @jjuergensen,
The aiowps function which obtains the IP address uses $_SERVER[‘REMOTE_ADDR’].
In most cases the above global should be the best and least spoofable way to obtain the IP address but there are special cases where certain webservers have a more unusual setup such as yours. In your case your server might have some proxy or CDN in front of it and hence you may need to make an adjustment via your wp-config.php file.
One example that you could try is the following code entered in your wp-config.php:
if ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) && preg_match( '/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/', $_SERVER['HTTP_X_FORWARDED_FOR'] ) )
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
Note that since I’m not familiar with how your hosting environment is setup, you might need to experiment with the above code because your real IP address might be located in any of the following globals:
‘HTTP_CF_CONNECTING_IP’, ‘HTTP_CLIENT_IP’, ‘HTTP_X_FORWARDED_FOR’, ‘HTTP_X_FORWARDED’, ‘HTTP_X_CLUSTER_CLIENT_IP’, ‘HTTP_FORWARDED_FOR’, ‘HTTP_FORWARDED’
It is also a good idea to talk to your host support crew and explain your situation to them because they should be able to point you to which $_SERVER global the real IP address will be in.
-
This reply was modified 7 years, 5 months ago by
wpsolutions.