Skip to content

Records wrong IP address #1361

@imbryan

Description

@imbryan

Problem: Axes records the IP address of the nginx container in the docker network for all access records.

django-axes[ipware]==8.0.0 running in Docker, behind nginx and Cloudflare DNS Proxy.

My nginx passes X_FORWARDED_FOR using proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for, which I've confirmed outputs correctly with custom logging:
"GET / HTTP/1.1" 200 17706 <user agent> XFF IN:"<my public IPv6>" XFF OUT:"<my public IPv6>, <cloudflare IP>"
Where XFF IN = $http_x_forwarded_for and XFF OUT = $proxy_add_x_forwarded_for.

Furthermore, I created a debug view in Django to output request.META values:
{"X_FORWARDED_FOR": "<my public IPv6>, <cloudflare IP>", "HTTP_X_FORWARDED_FOR": "<my public IPv6>, <cloudflare IP>"}

My AXES_IPWARE_META_PRECEDENCE_ORDER is set to: [ 'HTTP_X_FORWARDED_FOR', 'X_FORWARDED_FOR', 'REMOTE_ADDR', ]. I've also tried removing REMOTE_ADDR and the behavior persists.

For AXES_IPWARE_PROXY_COUNT, I've tried 2, 1, and None. It always ends up recording the nginx container's IP address.

Am I misconfiguring somewhere or could there be an underlying issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions