reading ip address 3rd from the back rather than the first one

This commit is contained in:
venusbb
2017-07-10 17:33:13 +01:00
parent 50d01d18c5
commit 226ae5784b

View File

@@ -48,7 +48,6 @@ def restrict_ip_sms():
if request.headers.get("X-Forwarded-For"):
# X-Forwarded-For looks like "203.0.113.195, 70.41.3.18, 150.172.238.178"
ip_route = request.headers.get("X-Forwarded-For")
# ip = ip_list.split(',')[0].strip()
ip_list = ip_route.split(',')
if len(ip_list) >= 3:
ip = ip_list[len(ip_list) - 3]