# HG changeset patch # User Marcin Kuzminski # Date 1362655203 -3600 # Node ID 64371c42e2f1ca9a6e7c01ad749657bd433567ba # Parent 0065f7fe60f6f60f936a060493f2582787edbe03 handle all cases with proxy IP addresses, not only for X_FORWARDED_FOR diff -r 0065f7fe60f6 -r 64371c42e2f1 rhodecode/lib/base.py --- a/rhodecode/lib/base.py Wed Mar 06 19:54:36 2013 +0100 +++ b/rhodecode/lib/base.py Thu Mar 07 12:20:03 2013 +0100 @@ -43,15 +43,17 @@ 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