From 5b94c444347de089982a39b626965c5d4f2c9c97 Mon Sep 17 00:00:00 2001 From: fermayo Date: Tue, 24 Jun 2014 18:01:12 +0200 Subject: [PATCH] Get first X-Forwarded-For IP --- axes/decorators.py | 1 + 1 file changed, 1 insertion(+) diff --git a/axes/decorators.py b/axes/decorators.py index 12556e8..b925399 100644 --- a/axes/decorators.py +++ b/axes/decorators.py @@ -66,6 +66,7 @@ def get_ip(request): else: logging.debug('Axes is configured to be behind reverse proxy...looking for header value %s', REVERSE_PROXY_HEADER) ip = request.META.get(REVERSE_PROXY_HEADER, '') + ip = ip.split(",", 1)[0].strip() if ip == '': raise Warning('Axes is configured for operation behind a reverse proxy but could not find '\ 'an HTTP header value {0}. Check your proxy server settings '\