IP record - Recording firewall IP instead of user

Hi Community,

I'm currently setting up my forum which is behind a UTM firewall. It seems the code used to record a users IP in Xenforo is using something similar to the following:

$ip = $_SERVER['REMOTE_ADDR']

However, that will return the Firewall IP address and not the user.

I've got some code which will return the correct IP address of the visiting user, but I’m unsure where the actual IP function in Xenforo is to update it?

There are just so many .php files o_O

Any help would be greatly appreciated.

Jack.
 
There isn't a central function in XenForo for the client IP.

Visit admin.php?tools/phpinfo and make sure REMOTE_ADDR shows your correct IP. If it's not correct then you can contact your host or server person to fix this. Or look for a server variable that contains the correct IP and then add this code to your library/config.php file:

Rich (BB code):
// FIX IP ADDRESS FOR PROXY
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_REAL_IP'];

Replace the red part with the name of the server variable that contains the correct IP (from your phpinfo).
 
Thanks very much that gives me something to work with. REMOTE_ADDR in PHPinfo is just returning the firewall IP, so i'll have a play. I should be able to get it work by editing the config.php file.

Thanks again.
Jack.
 
Hi,

Just a quick update. This variable fixes the problem seeing as the firewall is acting as a proxy server for requests both leaving and coming to the webserver.

HTTP_X_FORWARDED_FOR

Thank you.
 
Back
Top Bottom