[Zope] accessing REMOTE_ADDR
Tom Cameron
tom@cameron.to
Tue, 2 Oct 2001 13:26:05 +1000
I have worked around this problem using QSA (Query string append) in the Mod
Rewrite Module.
I found an article once on how you can modify the Apache Source and recomple
to make the ProxyPass transparant, but I was not to keen on trying it out.
http://www.stevek.com/projects/mod_tproxy/
Basically I use the Mod Rewrite rule with the [P] extension - works the same
as ProxyPass, but is more powerful.
For the REMOTE_ADDR (and any other Apache environment variables) you can
append them to the Query string using:
RewriteEngine on
RewriteRule ^/(.*) http://localhost:8080/$1?REMOTE_ADDR=%{REMOTE_ADDR}
[QSA,P]
Similar for any other apache variables:
HTTP_USER_AGENT
HTTP_REFERER
HTTP_COOKIE
HTTP_HOST
REMOTE_ADDR
REMOTE_HOST
REMOTE_USER
Be warned, this will not work on 'post' requests, only 'get'. But it is the
best way I know.
Tom
=> -----Original Message-----
=> From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
=> Timothy Wilson
=> Sent: Tuesday, 2 October 2001 12:47 PM
=> To: Zope listserv
=> Subject: [Zope] accessing REMOTE_ADDR
=>
=>
=> Hi everyone,
=>
=> I've been messing around with my Apache config and the ProxyVia directive
=> and searching the mailing list archive. I have yet to find the definitive
=> answer to this question:
=>
=> Is it possible to retrieve the actual IP address of the site visitor when
=> using Zope with Apache ProxyPass or Rewrite rules (without
=> patching Apache)?
=>
=> Has anyone had success with this? I'm running Zope 2.3.2 on Linux with
=> Apache 1.3.19. No matter what I try REMOTE_ADDR is still 127.0.0.1 and
=> HTTP_VIA still contains the domain of my Web server. I'd love to
=> hear that
=> someone has been able to do this.
=>
=> -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 )
=>