[Moin-user] X-Forwarded-For and moinmoin
David Montgomery
davidlmontgomery at gmail.com
Thu Aug 30 01:16:05 EDT 2007
Hi,
My wiki was showing 'localhost' for all the page
editor ip addresses. I suspected that it was behind
an apache proxy.
Modifying request.py's _setup_vars_from_std_env
so that self.remote_addr was set as follows
remote_address = env.get('REMOTE_ADDR', '')
if remote_address != '127.0.0.1':
self.remote_addr = remote_address
else:
header = (env.get('x-forwarded-for') or
env.get(cgiMetaVariable('x-forwarded-for')))
if not header:
self.remote_addr = remote_address
else:
self.remote_addr = header.split(',')[-1].strip()
(basically borrowing from
http://bob.pythonmac.org/archives/2005/09/23/apache-x-forwarded-for-caveat/ )
fixed this problem for me.
(I tried to add this to
http://moinmoin.wikiwikiweb.de/MoinMoinQuestions/Unsorted
where someone else was asking about the same problem,
but I'm currently getting 500 errors there.)
David
More information about the Moin-user
mailing list