[Zope] Accessing site visitor's IP (solved!)
Timothy Wilson
wilson@visi.com
Fri, 19 Oct 2001 11:06:24 -0500 (CDT)
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