CGI (env "REMOTE_ADDR") question

For the Compleat Fan
Locked
cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

CGI (env "REMOTE_ADDR") question

Post 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?

Jeff
Posts: 604
Joined: Sat Apr 07, 2007 2:23 pm
Location: Ohio
Contact:

Post by Jeff »

Proxy servers? I don't know. Maybe it's an error :)
Jeff
=====
Old programmers don't die. They just parse on...

Artful code

Tim Johnson
Posts: 253
Joined: Thu Oct 07, 2004 7:21 pm
Location: Palmer Alaska USA

Post by Tim Johnson »

I've never seen such a thing. Are you able to elaborate - safely -
without leaving anything open to exploit?
tim

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Post 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..

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post 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...
-- (define? (Cornflakes))

Jeff
Posts: 604
Joined: Sat Apr 07, 2007 2:23 pm
Location: Ohio
Contact:

Post by Jeff »

What's your apache log format string?
Jeff
=====
Old programmers don't die. They just parse on...

Artful code

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Post 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?

Jeff
Posts: 604
Joined: Sat Apr 07, 2007 2:23 pm
Location: Ohio
Contact:

Post by Jeff »

No idea. That was a complete shot in the dark. :)
Jeff
=====
Old programmers don't die. They just parse on...

Artful code

Locked