lib: fix parsing of remote IP header when behind multiple reverse proxies

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-05-15 15:08:53 +02:00
parent 6600d5bf69
commit 968b7ec17a
1 changed files with 2 additions and 1 deletions

View File

@ -17,7 +17,8 @@ def _get_client_ip_from_meta(meta: dict[str, Any]) -> Optional[str]:
) )
for _header in headers: for _header in headers:
if _header in meta: if _header in meta:
return meta.get(_header).split(", ")[0] ips: list[str] = meta.get(_header).split(",")
return ips[0].strip()
return None return None