From 968b7ec17a518bfc6d9e70d89870d3d394862510 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sat, 15 May 2021 15:08:53 +0200 Subject: [PATCH] lib: fix parsing of remote IP header when behind multiple reverse proxies Signed-off-by: Jens Langhammer --- authentik/lib/utils/http.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/authentik/lib/utils/http.py b/authentik/lib/utils/http.py index a06293327..6b0a2da78 100644 --- a/authentik/lib/utils/http.py +++ b/authentik/lib/utils/http.py @@ -17,7 +17,8 @@ def _get_client_ip_from_meta(meta: dict[str, Any]) -> Optional[str]: ) for _header in headers: if _header in meta: - return meta.get(_header).split(", ")[0] + ips: list[str] = meta.get(_header).split(",") + return ips[0].strip() return None