[Zope] Accessing site visitor's IP (solved!)

sean.upton@uniontrib.com sean.upton@uniontrib.com
Fri, 19 Oct 2001 10:51:46 -0700


The same idea works for Squid or any other proxy, by the way.  We use Squid
instead of Apache for proxy, load-blancing, and URL rewrite services in
front of our Zope servers, and we had to do this as well in our
applications.

Sean

-----Original Message-----
From: Timothy Wilson [mailto:wilson@visi.com]
Sent: Friday, October 19, 2001 9:06 AM
To: Zope listserv
Subject: [Zope] Accessing site visitor's IP (solved!)


Hi everyone,

I posted several weeks ago trying to determine if there was a definitive
method to retrieve the IP address of a visitor to my Web site. My real
motivation was simply to determine if the visitor was browsing from our LAN
or from outside our organization. A number of suggestions were made and
there was some disagreement about how useful such a thing would be and if it
was doable at all.

I'm glad to report that it is doable--at least for my purposes. I ended up
using an Apache module called mod_proxy_add_forward. This module adds an
HTTP_X_FORWARDED_FOR header that contains the visitor's IP address even if
your Zope if running behind Apache. If your visitor is on a NAT'ed network
then you'll get the IP address of his or her proxy server.

This works perfectly for me and since this module is available as a Debian
package total installation time was less than one minute. (Gotta love
apt-get!)

I've written up a How-To at Zope.org describing it in more detail. It should
be available at http://www.zope.org/Members/TWilson/GettingVisitorsIP. I
would appreciate feedback on this How-To.

Thanks for all the suggestions that have been made on this topic in the past
couple weeks. They are very helpful. One final note: please don't use this
for controlling access to your site. IP addresses are too easily faked.

-Tim

--
Tim Wilson      |   Visit Sibley online:   | Check out:
Henry Sibley HS |  http://www.isd197.org   | http://www.zope.com
W. St. Paul, MN |                          | http://slashdot.org
wilson@visi.com |  <dtml-var pithy_quote>  | http://linux.com


_______________________________________________
Zope maillist  -  Zope@zope.org
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )