[Django]-Django: request.META['REMOTE_ADDR'] is always '127.0.0.1'

7👍

Do you have any kind of proxy, gateway, or load balancer running on that remote host? That’s the sort of thing that would cause connections to appear to be from 127.0.0.1 (because that’s where the immediate connection is from, as far as the web server is concerned).

0👍

If you are behind a proxy and running apache as the webserver you could use mod_rpaf. The proxy only needs to send X-Forwarded-For or X-Real-IP headers.

http://stderr.net/apache/rpaf/

👤bjunix

Leave a comment