Skip to content

Commit cda2b96

Browse files
committed
feat: django-axes prefers forwarded ip address
Prioritize `HTTP_X_FORWARDED_FOR` for django-axes similar to audit logs with the get_client_ip. https://django-axes.readthedocs.io/en/latest/4_configuration.html#configuring-reverse-proxies Refs: PT-2026
1 parent f6af725 commit cda2b96

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

palvelutarjotin/settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,8 @@ def sentry_traces_sampler(sampling_context: SamplingContext) -> float:
447447

448448
AXES_FAILURE_LIMIT = 5
449449
AXES_COOLOFF_TIME = 1 # hour after locked out, user will be able to attempt login
450+
AXES_IPWARE_META_PRECEDENCE_ORDER = ["HTTP_X_FORWARDED_FOR", "REMOTE_ADDR"]
451+
AXES_IPWARE_PROXY_COUNT = 1
450452

451453
LOGGING = {
452454
"version": 1,

0 commit comments

Comments
 (0)