Live Helper Chat support forum.. Forum is locked. New place for questions - Github Discussions

You are not logged in.

Announcement

#1 2013-12-31 17:46:59

Nam Nguyễn Lê Hoài
Member
Registered: 2013-12-29
Posts: 5

LHC get wrong user ip address

Because I use pagespeed_mod, my apache web service is behind caching proxy. So then when a user visit my site, LHC get a wrong ip address.
It makes my apache log get a wrong ip too. But I can fix it with this article http://www.techstacks.com/howto/log-client-ip-and-xforwardedfor-ip-in-apache.html
But I can't find out a way to make it work with LHC.
Thanks for your time.

https://groups.google.com/forum/#!topic … qab_9ErwQ8

Offline

#2 2013-12-31 18:21:24

Nam Nguyễn Lê Hoài
Member
Registered: 2013-12-29
Posts: 5

Re: LHC get wrong user ip address

I can fix it by edit the file in: \lib\core\lhcore\lhipdetect.php

Line 14: return $_SERVER["REMOTE_ADDR"];
Replace with:        if ($_SERVER['HTTP_X_FORWARDED_FOR']){            return $_SERVER['HTTP_X_FORWARDED_FOR'];        }else{             return $_SERVER['REMOTE_ADDR'];}
But I don't know if it could fix all the problem because I see there are some other $_SERVER["REMOTE_ADDR"] in this file.And with one real visitor, it generated 2 visit: one with the correct ip, one other with the wrong ip.

Offline

Board footer