Werkzeug(和Flask)将标头存储在的实例中
werkzeug.datastructures.Headers。您应该能够执行以下操作:
provided_ips = request.headers.getlist("X-Forwarded-For")# The first entry in the list should be the client's IP.或者,您可以使用
request.access_route(感谢@Bastian指出这一点!):
provided_ips = request.access_route# First entry in the list is the client's IP



