forward can be multiple ips, take first

This commit is contained in:
j 2013-08-30 10:41:04 +02:00
parent 7c6757f417
commit 3ef93908b6

View file

@ -107,7 +107,7 @@ class SessionData(models.Model):
if request.user.is_authenticated():
data.user = request.user
if 'HTTP_X_FORWARDED_FOR' in request.META:
data.ip = request.META['HTTP_X_FORWARDED_FOR']
data.ip = request.META['HTTP_X_FORWARDED_FOR'].split(',')[0]
else:
data.ip = request.META['REMOTE_ADDR']
if data.ip.startswith('::ffff:'):