mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-18 06:51:45 -05:00
reading ip address 3rd from the back rather than the first one
This commit is contained in:
@@ -47,9 +47,12 @@ def restrict_ip_sms():
|
|||||||
ip = ''
|
ip = ''
|
||||||
if request.headers.get("X-Forwarded-For"):
|
if request.headers.get("X-Forwarded-For"):
|
||||||
# X-Forwarded-For looks like "203.0.113.195, 70.41.3.18, 150.172.238.178"
|
# X-Forwarded-For looks like "203.0.113.195, 70.41.3.18, 150.172.238.178"
|
||||||
ip_list = request.headers.get("X-Forwarded-For")
|
ip_route = request.headers.get("X-Forwarded-For")
|
||||||
ip = ip_list.split(',')[0].strip()
|
# ip = ip_list.split(',')[0].strip()
|
||||||
current_app.logger.info("Inbound sms ip route list {}".format(ip_list))
|
ip_list = ip_route.split(',')
|
||||||
|
if len(ip_list) >= 3:
|
||||||
|
ip = ip_list[len(ip_list) - 3]
|
||||||
|
current_app.logger.info("Inbound sms ip route list {}".format(ip_route))
|
||||||
|
|
||||||
if ip in current_app.config.get('ALLOW_IP_INBOUND_SMS'):
|
if ip in current_app.config.get('ALLOW_IP_INBOUND_SMS'):
|
||||||
current_app.logger.info("Inbound sms ip addresses {} passed ".format(ip))
|
current_app.logger.info("Inbound sms ip addresses {} passed ".format(ip))
|
||||||
|
|||||||
Reference in New Issue
Block a user