From 5ae6fafad7b2de9d5df042a6e07e41d746b4b59b Mon Sep 17 00:00:00 2001 From: Jacob Kaplan-Moss Date: Thu, 20 Sep 2007 17:03:14 +0000 Subject: [PATCH] Fixed #3872, which turns out to not have been a bug in the first place, by reverting [6364]. git-svn-id: http://code.djangoproject.com/svn/django/trunk@6397 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/middleware/http.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/django/middleware/http.py b/django/middleware/http.py index 78e066c67b..71cdf7aa5d 100644 --- a/django/middleware/http.py +++ b/django/middleware/http.py @@ -54,8 +54,7 @@ class SetRemoteAddrFromForwardedFor(object): except KeyError: return None else: - # HTTP_X_FORWARDED_FOR can be a comma-separated list of IPs. - # Take just the last one. - # See http://bob.pythonmac.org/archives/2005/09/23/apache-x-forwarded-for-caveat/ - real_ip = real_ip.split(",")[-1].strip() + # HTTP_X_FORWARDED_FOR can be a comma-separated list of IPs. The + # client's IP will be the first one. + real_ip = real_ip.split(",")[0].strip() request.META['REMOTE_ADDR'] = real_ip