Welcome! Log In Create A New Profile

Advanced

Django

Posted by randomuser 
Django
October 02, 2010 06:30AM
Hey guys!

I currently have nginx forwarding my ajax requests to my Django project.

I would like to grab the client's IP address in my Django code. In the past, I did this by simply calling "request.META['REMOTE_ADDR']", but this doesn't seem to work anymore.

After doing a little research, it seemed that I needed to add the following to my config file:

proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

But I still can't seem to grab the user's IP address! Am I forgetting something? :(

Thanks!
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 162
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready