thanks david it is the original requesters address On Mon, Jul 6, 2009 at 2:04 AM, David Montgomery <[email protected]>wrote:
> Here is the repsonse from webfaction that will explain the issue.... > > > I have two sites running. One is a static/cgi/php site and the other is > a > > wsgi site both using a shared IP. > > > > I use ip = env['REMOTE_ADDR'] to get the remote address. > > > > When I save ip in a table for the static site I see what I believe is the > > correct IP. On the wsgi site I see 127.0.0.1. If I remove the wsgi site > > and use a static site then I get the correct referer IP. Why does this > > happen for a wsgi site? > > > All requests to your sites are proxied from the front-end web server to > another server internally. So, when the request reaches your app, it's > actually coming from the internal IP 127.0.0.1. > > When the request is proxied, the original IP is stored in the > X-Forwarded-For > header. > > Static/CGI/PHP sites are proxied to our shared Apache+PHP environment. That > environment uses an Apache module to masquerade X-Forwarded-For as > REMOTE_ADDR. > > Your other apps do not use that module, so if you need to check IP for > those > apps (like a mod_wsgi site) then you need to look at X-Forwarded-For. > > Hope that helps! > > On Sun, Jul 5, 2009 at 9:36 PM, paul jobs <[email protected]> wrote: > >> web.ctx.env['HTTP_X_FORWARDED_FOR'] wat is this? >> >> On Mon, Jul 6, 2009 at 12:06 AM, Anand Chitipothu >> <[email protected]>wrote: >> >>> >>> >>> 2009/7/6 Monty808 <[email protected]> >>> >>>> >>>> Hi, >>>> >>>> Normally I use env['REMOTE_ADDR'] to get the IP address. But..on >>>> webfaction using wsgi...I have to use X-Forwarded-For to get the IP >>>> address. >>>> >>>> So...what is the code to get the IP address? >>> >>> >>> Try using web.ctx.ip. If that doesn't work, try >>> web.ctx.env['HTTP_X_FORWARDED_FOR']. >>> >>> >>> >>> >>> >> >> >> -- >> BidEgg - Worlds best low price Auction site >> http://bidegg.com >> >> >> >> > > > -- > David Montgomery > Chief Technical Officer > Ad Aloha > http://www.AdAloha.com > Honolulu, Hawaii 96815 > 808-351-5046 > Calandar > http://users.adaloha.com/davidmontgomery_calandar > > > > > > > -- BidEgg - Worlds best low price Auction site http://bidegg.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web.py" 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/webpy?hl=en -~----------~----~----~----~------~----~------~--~---
