BUG: IP address behind proxy is not resolved correctly
gunnerson opened this issue · comments
Describe the bug
I have a django app running behind gunicorn+nginx. [Access attempts] don't save ip address on production server. request.META.get('HTTP_X_FORWARDED_FOR') returns my ip-address. If I test it on dev server it saves 127.0.0.1 but in production ip address field stays empty. I tried all the combinations of config parameters I could think of. My current config:
AXES_FAILURE_LIMIT = 5
AXES_COOLOFF_TIME = 1
AXES_IPWARE_PROXY_COUNT = 1
AXES_IPWARE_META_PRECEDENCE_ORDER = ('HTTP_X_FORWARDED_FOR',)
AXES_LOCKOUT_PARAMETERS = [["username", "ip_address"]]
Your environment
python version: 3.11.2
django version: 4.1.7
django-axes version: 6.0.5
django-ipware version: 5.0.0
Operating system:
Debian GNU/Linux 12
Kernel: Linux 6.1.0-9-amd64
@gunnerson has the IP address resolution been working previously, did you upgrade from version 5 to version 6?
Have you also installed the django-ipware
package with either explicit installation or with django-axes[ipware]
install specifier? The implicit dependency for the ipware package has been dropped in version 5, and it has to be installed explicitly.
Is ipware
in your Django INSTALLED_APPS
configuration setting?
I started using from V6, didn't upgrade.
If by explicit installation you mean pip3 install django-ipware
then yes.
It's in my INSTALLED_APPS
before axes
Have you set the header with the nginx proxy_set_header
directive?