diff --git a/grails-web-common/src/main/groovy/org/grails/web/servlet/mvc/GrailsWebRequest.java b/grails-web-common/src/main/groovy/org/grails/web/servlet/mvc/GrailsWebRequest.java index 3e662f13f5a..65527aa663d 100644 --- a/grails-web-common/src/main/groovy/org/grails/web/servlet/mvc/GrailsWebRequest.java +++ b/grails-web-common/src/main/groovy/org/grails/web/servlet/mvc/GrailsWebRequest.java @@ -466,7 +466,7 @@ public String getBaseUrl() { StringBuilder sb=new StringBuilder(); sb.append(scheme).append("://").append(request.getServerName()); - int port = request.getServerPort(); + int port = request.getServerPort() ?: request.getHeader("X-Forwarded-Port"); //ignore port append if the request was forwarded from a VIP as actual source port is now not known if (forwardedScheme == null && (("http".equals(scheme) && port != 80) || ("https".equals(scheme) && port != 443))) {