[Zope] UserCounter mod for reverse proxy

Jaroslav Lukesh lsh@wo.cz
Wed, 9 Jul 2003 17:59:24 +0200


Hi all,

I was install UserCounter produuct and they show me still 2 users. I was
look at details and they show IP of my pound proxy and my IP. I was done
smll mod for those who uses reverse proxy. 

In Counter.py change these lines


def __call__(self, client, request, response=None):
        '''Traversing'''
        # Refresh the client's last access time
        remote_ip = request['REMOTE_ADDR']


to that lines:


def __call__(self, client, request, response=None):
        '''Traversing'''
        # Refresh the client's last access time
        #remote_ip = request['REMOTE_ADDR']
        #obsolete. Zope is manytimes behind reverse proxy, so we need
X_forwarded_for
        #changes 2003-07-09 by Jaroslav Lukesh, lsh@wo.cz
        remote_ip = request['HTTP_X_FORWARDED_FOR'] or
request['REMOTE_ADDR']


Enjoy!

JL.