Page 1 of 1

CGI (env "REMOTE_ADDR") question

Posted: Thu Jun 05, 2008 8:40 pm
by cormullion
Do any of you CGI wizards know why (env "REMOTE_ADDR") in a CGI environment sometimes returns two IP addresses rather than one?

Posted: Fri Jun 06, 2008 11:42 am
by Jeff
Proxy servers? I don't know. Maybe it's an error :)

Posted: Sat Jun 07, 2008 3:24 pm
by Tim Johnson
I've never seen such a thing. Are you able to elaborate - safely -
without leaving anything open to exploit?
tim

Posted: Sat Jun 07, 2008 3:46 pm
by cormullion
Well, the matching entry in the Apache log is like this:

Code: Select all

64.27.13.129, 217.219.95.60 - - [05/Jun/2008:02:17:37 -0700] "POST /comment.cgi HTTP/1.0" 200 59498 ...
- that's a spammer caught in the act of posting some spam. :) My code is using (env REMOTE_ADDR) and therefore picking up two IP addresses ...

Since these double IPs appear a lot in the log, I had presumed they're something well known..

Posted: Sat Jun 07, 2008 5:09 pm
by newdep
if you always have double IP's then the first is the Apache-Server the second the client.

If you have it randomly it could be a redirect..from source..
Like from google -> destination..

But thats all i know...

Posted: Sat Jun 07, 2008 5:53 pm
by Jeff
What's your apache log format string?

Posted: Sat Jun 07, 2008 6:33 pm
by cormullion
It seems to be this:

clientip - username [time] "request" status bytes "referer" "useragent"

I think your 'proxy server' suggestion is right, Jeff. In that case, which one would identify that user again?

Posted: Sat Jun 07, 2008 8:45 pm
by Jeff
No idea. That was a complete shot in the dark. :)