# HG changeset patch # User Marcin Kuzminski # Date 2013-03-07 11:20:03 # Node ID ef21dadcaa7c812f63d31f8128d3e519058bbb8c # Parent 994dfdd0c920db6ad8aa3f2f445cf0dd72d077e4 handle all cases with proxy IP addresses, not only for X_FORWARDED_FOR diff --git a/rhodecode/lib/base.py b/rhodecode/lib/base.py --- a/rhodecode/lib/base.py +++ b/rhodecode/lib/base.py @@ -43,15 +43,17 @@ def _get_ip_addr(environ): ip = environ.get(proxy_key2) if ip: - # HTTP_X_FORWARDED_FOR can have mutliple ips inside - # the left-most being the original client, and each successive proxy - # that passed the request adding the IP address where it received the - # request from. - if ',' in ip: - ip = ip.split(',')[0].strip() return ip ip = environ.get(def_key, '0.0.0.0') + + # HEADERS can have mutliple ips inside + # the left-most being the original client, and each successive proxy + # that passed the request adding the IP address where it received the + # request from. + if ',' in ip: + ip = ip.split(',')[0].strip() + return ip