##// END OF EJS Templates
handle all cases with proxy IP addresses, not only for X_FORWARDED_FOR
marcink -
r3493:64371c42 beta
parent child Browse files
Show More
@@ -43,15 +43,17 b' def _get_ip_addr(environ):'
43
43
44 ip = environ.get(proxy_key2)
44 ip = environ.get(proxy_key2)
45 if ip:
45 if ip:
46 # HTTP_X_FORWARDED_FOR can have mutliple ips inside
47 # the left-most being the original client, and each successive proxy
48 # that passed the request adding the IP address where it received the
49 # request from.
50 if ',' in ip:
51 ip = ip.split(',')[0].strip()
52 return ip
46 return ip
53
47
54 ip = environ.get(def_key, '0.0.0.0')
48 ip = environ.get(def_key, '0.0.0.0')
49
50 # HEADERS can have mutliple ips inside
51 # the left-most being the original client, and each successive proxy
52 # that passed the request adding the IP address where it received the
53 # request from.
54 if ',' in ip:
55 ip = ip.split(',')[0].strip()
56
55 return ip
57 return ip
56
58
57
59
General Comments 0
You need to be logged in to leave comments. Login now