[Fixed]-Nginx does not forwards remote address to gunicorn

1👍

That is correct and expected behavior. If you would like to access users IP you will need to use:

request.META['HTTP_X_FORWARDED_FOR']

Note that in development (without running nginx), REMOTE_ADDR is still correct.

My recommendation is to add a middleware or a utility method which will do the conditional logic to get the actual users IP depending on your settings.

Leave a comment