def get_real_source_ip():
"""
Returns the real source IP address of the HTTP request.
"""
if 'X-Forwarded-For' in request.headers:
return request.headers.getlist("X-Forwarded-For")[0].rpartition(' ')[-1]
else:
return request.environ['REMOTE_ADDR']
评论列表
文章目录