Private IP showing instead of Public IP.

dunowat

Member
I've been trying to figure out how to get the user ip in the admin.log instead of my external IP. I've tried a few things listed here but it didn't work.

https://xenforo.com/community/threa...the-load-balancers-private-ip-address.162663/

I've confirmed in the logs that the records are being logged with the external IP but I cannot get xenforo to recognize it.

I was forwarded from support ticket to here. Looking for some assistance on this.

ubuntu@service:/home/user/web/folder/logs# tail -f xxxx.net.log
76.88.17.48 10.0.0.234 - - [27/Mar/2024:04:09:50 +0000] "GET /index.php?account/visitor-menu&_xfRequestUri=%2Findex.php&_xfWithData=1&_xfToken=1711511839%2C651516e8aa13491ed528adcbfd5a69ce&_xfResponseType=json HTTP/1.0" 200 1849 "https://website/index.php" "Mozilla/5.0 (iPhone; CPU iPhone OS 17_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3.1 Mobile/15E148 Safari/604.1"
 
Why not sharing the solution to help others with the same issue in the future?
Sure!

The answer was in the first post. The main thing I got wrong was the file that needed to be edited and add this to src/config.php


PHP:
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']))
{
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
 
Top Bottom