]> granicus.if.org Git - ejabberd/commitdiff
Use correct virtual host when consulting trusted_proxies
authorEvgeny Khramtsov <ekhramtsov@process-one.net>
Sat, 13 Jul 2019 09:20:06 +0000 (12:20 +0300)
committerEvgeny Khramtsov <ekhramtsov@process-one.net>
Sat, 13 Jul 2019 09:20:06 +0000 (12:20 +0300)
src/ejabberd_http.erl

index 6f90cfcd75ed9e198b87b29c29b7389bb882dddc..368a5227eaa67a8b58d6334d4e729fa7e3857708 100644 (file)
@@ -530,7 +530,8 @@ analyze_ip_xff(IP, [], _Host) -> IP;
 analyze_ip_xff({IPLast, Port}, XFF, Host) ->
     [ClientIP | ProxiesIPs] = str:tokens(XFF, <<", ">>) ++
                                [misc:ip_to_list(IPLast)],
-    TrustedProxies = ejabberd_option:trusted_proxies(Host),
+    ServerHost = ejabberd_router:host_of_route(Host),
+    TrustedProxies = ejabberd_option:trusted_proxies(ServerHost),
     IPClient = case is_ipchain_trusted(ProxiesIPs,
                                       TrustedProxies)
                   of