You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi guys,
I have a few sites that the IP recorded for each activity is always 127.0.0.1 instead of the real user/guest IP.
It took me a while but I found that the one thing they have in common is that they were all served using a proxy either ngnix or varnish.
which makes sense because the server (apache or ngnix) gets the request from the proxy (varnish or ngnix) which is on the same machine and that is why i get the local host IP (127.0.0.1) as user IP which is actually wrong.
A better way to get the real IP even in the case of a proxy you should first look in the $_SERVER['HTTP_CLIENT_IP'] var then in the $_SERVER['HTTP_X_FORWARDED_FOR']
and only then in the $_SERVER['REMOTE_ADDR']
Hi guys,
I have a few sites that the IP recorded for each activity is always 127.0.0.1 instead of the real user/guest IP.
It took me a while but I found that the one thing they have in common is that they were all served using a proxy either ngnix or varnish.
which makes sense because the server (apache or ngnix) gets the request from the proxy (varnish or ngnix) which is on the same machine and that is why i get the local host IP (127.0.0.1) as user IP which is actually wrong.
looking at the code this line in specific is the problematic one
https://github.com/KingYes/wordpress-aryo-activity-log/blob/master/classes/class-aal-api.php#L55
A better way to get the real IP even in the case of a proxy you should first look in the
$_SERVER['HTTP_CLIENT_IP']
var then in the$_SERVER['HTTP_X_FORWARDED_FOR']
and only then in the
$_SERVER['REMOTE_ADDR']
for example:
thanks.
Happy Yom haatzmaut;
The text was updated successfully, but these errors were encountered: