Skip to content

Commit 49bec41

Browse files
committed
Fix #1114 HttpUtils getGitblitURL does not support nonstandard ports
X-Forwarded-Host can contain port number and it is added twice in that situation This fix just prevent adding port number if it is already there
1 parent b03fc53 commit 49bec41

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/main/java/com/gitblit/utils/HttpUtils.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,9 @@ public static String getGitblitURL(HttpServletRequest request) {
110110
sb.append(host);
111111
if (("http".equals(scheme) && port != 80)
112112
|| ("https".equals(scheme) && port != 443)) {
113-
sb.append(":").append(port);
113+
if (!host.endsWith(":" + port)) {
114+
sb.append(":").append(port);
115+
}
114116
}
115117
sb.append(context);
116118
return sb.toString();

0 commit comments

Comments
 (0)