That doesn't work if you're proxying behind Apache; you'll get the
localhost IP instead.  Do this if you might ever be proxying:

remote_addr = request.environ.get("HTTP_X_FORWARDED_FOR")
if not remote_addr:
    request.environ.get("REMOTE_ADDR")

--Mike

On 8/1/07, Jose Galvez <[EMAIL PROTECTED]> wrote:
>
> try request.environ['REMOTE_ADDR']
>
> I usually drop this action into one of my controller to remind me of all
> the environ values
> def env(self):
>        '''
>        Note this is a pylons 0.9.6 action, for pre 0.9.6 return
> Response('\n'.join(html))
>        '''
>         esc = h.util.html_escape
>         html = ['<table><tr>']
>         for k,v in request.environ.items():
>             html.append('<td>'+esc(k)+'</td><td>'+esc(v)+'</td></tr>')
>         html.append('</tr></table>')
>         return '\n'.join(html)
>
> Hope this helps
> Jose
>
> SamDonaldson wrote:
> > Hello,
> >
> > I was wondering if there's some standard WSGI header that gets set in
> > the middleware that would allow my app to access the requester's IP
> > address?  This is not the referer, but the IP address of the user
> > that's accessed that page that makes a call my server.
> >
> > Thanks,
> >
> > Sam.
> >
> >
> > >
> >
> >
>
> >
>


-- 
Mike Orr <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to