[Twisted-web] Re: how to get remote add use twsited.web2

xiao lianyi xiaolianyi at gmail.com
Tue Nov 20 22:58:41 EST 2007


I'm sorry for my without thking words saying that use
request.remoteAddr.host can't get client ip address
actually it works well.

Because AJAX's GET or POST method have domain limitation, and I deploy my
twisted.web2 program under Nginx.
so it is not a client direct request my web2 program, it's nginx request my.


web2 program is allways get 127.0.0.1.

i solve it in this way, edit nginx configure file,
add proxy_set_header   REMOTE_ADDR   $remote_addr;[1]
web2 program file
use request.headers._raw_headers.get('remote_addr', ['192.168.1.1'])[0]


[1]:http://wiki.codemongers.com/NginxHttpCoreModule#var_remote_addr

Graeme Glass,Jean-Paul: thanks for your reply^_^


2007/11/21, Jean-Paul Calderone <exarkun at divmod.com>:
>
> It's better to explain how something didn't meet your expectations rather
> than to just say that it didn't.
>
> What about request.remoteAddr is not suitable?
>
> Jean-Paul
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-web/attachments/20071121/1b=
657e0c/attachment.htm


More information about the Twisted-web mailing list