From c51b0e479065322ea66cac5536f4de4931cb94cd Mon Sep 17 00:00:00 2001 From: "Maria Odea B. Ching" Date: Tue, 12 Jan 2010 07:56:46 +0000 Subject: [PATCH] [MRM-1268] X-Forwarded-Host handling when having more than one proxy submitted by Andreas Baumann o taking just the outermost (first one) proxy in the 'X-Forwarded-Host' HTTP field git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@898212 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/maven/archiva/web/util/ContextUtils.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/ContextUtils.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/ContextUtils.java index 9579dbba0..f1b689cea 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/ContextUtils.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/ContextUtils.java @@ -111,6 +111,12 @@ public class ContextUtils } return name; } + else + { + // respect chains of proxies, return first one (as it's the outermost visible one) + String[] hosts = name.split( "," ); + name = hosts[0].trim(); + } return name; } }