I'm having trouble getting the IP address of the exit node that hits my hidden service (PHP). No matter what I try, it comes back as local (127.0.0.1), as if it's going through a proxy.
I have Tor configured like this:
HiddenServicePort 80 127.0.0.1:9028
and Lighty like this:
server.port = 9028
which means the hit against the hidden service should arrive through Tor on virtual port 80
, get directed to 9028
on Lightly, and then served to the end user.
I have privoxy installed too but I don't believe it has anything to do with Tor hidden services (I've confirmed this thru the privoxy debug logs).
I've tried code like this:
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
return $_SERVER['HTTP_CLIENT_IP'];
} else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
return $_SERVER['HTTP_X_FORWARDED_FOR'];
}
return $_SERVER['REMOTE_ADDR'];
but the headers don't include any forwarding IP information.
What am I missing? Why can't Lightly see the exit node IP address? Is there a way I could configure a proxy in there somewhere that could alter the headers and inject the X-FORWARDED header? I don't care to lookup the exit node in the public database - I just want the IP address.
You need to check more server vars than that. I would do something like this:
Hopefully that helps.