[Product-Developers] How to get the user's IP address

Mark Phillips mark at phillipsmarketing.biz
Tue Apr 22 16:23:51 UTC 2008


I found this in a plone product source code (PASPlugins - IPRangePlugin)

ip = request.get('HTTP_X_FORWARDED_FOR') or request.get('REMOTE_ADDR',
None)

Any other suggestions for getting around the proxy in front of zope?

Thanks!

Mark

On Tue, 2008-04-22 at 12:16 -0400, Tim Hicks wrote:
> Mark Phillips wrote:
> > How do I get an anonymous user's IP address from within a Plone
> product?
> >
> > I want to modify PloneSurvey to return the user's IP address with
> the
> > survey submission. We only use anonymous surveys, so I want some way
> to
> > see if someone is stuffing the survey box. I know an IP address is
> not
> > the best way, but I think in my particular use case it will be
> > effective.
> >
> > There is a method in PloneSurvey that returns and id for anonymous
> > submissions. I just don't know how to access the anonymous user's IP
> > address from within Plone.
> 
> REQUEST['REMOTE_ADDR']?  Actually, I think there's another way (i.e.
> request key) for when you have a proxy in front of your zope, but I
> forget that now.
> 
> Tim
> 
> 




More information about the Product-Developers mailing list