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!
--
David Montgomery
Chief Technical Officer
Ad Aloha
http://www.AdAloha.comHonolulu, Hawaii 96815
808-351-5046
Calandar
http://users.adaloha.com/davidmontgomery_calandar