sengjai
Forum Replies Created
-
Hi Nicole,
Can you try this, please put this into your wp-config.php
$output = (preg_split(‘/:/’,$_SERVER[‘HTTP_X_FORWARDED_FOR’]));
echo $output;Then view your website’s front page, and screen shot what is the ip address that is shown there.
Thanks!
Best regards,
Soon SengHi there,
So for this particular situation, I knew the problem was that it was still loading the server ip address. I just forced the ip to change to the external one:-
Take note, the eg ip address that came out xxx.xxx.xxx.xxx:8080
$output = (preg_split(‘/:/’,$_SERVER[‘HTTP_X_FORWARDED_FOR’]));
$_SERVER[‘REMOTE_ADDR’] = $output[0]; //this returns the ip address without the PORT numberThat’s it!
Hi there,
So I managed to solve it. The ip that was correct $_SERVER[‘HTTP_X_FORWARDED_FOR’];
However, when i echoed it out, it has a port number behind. So although setting $_SERVER[‘REMOTE_ADDR’] = $_SERVER[‘HTTP_X_FORWARDED_FOR’]; it still didn’t work because of the port number,
Hence I had to do a split
$output = (preg_split(‘/:/’,$_SERVER[‘HTTP_X_FORWARDED_FOR’]));
$_SERVER[‘REMOTE_ADDR’] = $outputThat finally worked. So I didn’t have problems on other servers, but this particular clients server was working on Azure Linux, not too sure what was the configuration whether they had CDN or Proxy on it.
Anyway thanks for the update! Hope my input will help the others facing this issue!
Hi there,
I seem to be having the same problem as jjuergensen.
And I’ve use
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’];It doesn’t seem to work. The current server for my client is Azure. I tried wordfence, it seem to be able to read the proper external ip. But AIOWPS keep showing me the same ip address which is the current hosted server ip address. Anything else I can try to make aiowps read the external ip?
Thanks!