From 94f4f74892c658fb1545f02fdf9543b922fc3cc1 Mon Sep 17 00:00:00 2001 From: Piero Toffanin Date: Wed, 8 Sep 2021 21:41:12 +0200 Subject: [PATCH] Better X-Forwarded-For logic --- app/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/app.py b/app/app.py index 1bcc8c7..df00f76 100644 --- a/app/app.py +++ b/app/app.py @@ -20,7 +20,7 @@ def get_json_dict(request): def get_remote_address(): if request.headers.getlist("X-Forwarded-For"): - ip = request.headers.getlist("X-Forwarded-For")[0] + ip = request.headers.getlist("X-Forwarded-For")[0].split(",")[0] else: ip = request.remote_addr or "127.0.0.1"