File tree 1 file changed +7
-1
lines changed
grails-web-common/src/main/groovy/org/grails/web/servlet/mvc
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -467,11 +467,17 @@ public String getBaseUrl() {
467
467
sb .append (scheme ).append ("://" ).append (request .getServerName ());
468
468
469
469
int port = request .getServerPort ();
470
-
470
+ String forwardedPort = request .getHeader ("X-Forwarded-Port" );
471
+
471
472
//ignore port append if the request was forwarded from a VIP as actual source port is now not known
472
473
if (forwardedScheme == null && (("http" .equals (scheme ) && port != 80 ) || ("https" .equals (scheme ) && port != 443 ))) {
473
474
sb .append (":" ).append (port );
475
+ } else if (forwardedPort != null &&
476
+ ("http" .equals (forwardedScheme ) && !"80" .equals (forwardedPort )) ||
477
+ ("https" .equals (forwardedScheme ) && !"443" .equals (forwardedPort ))) {
478
+ sb .append (":" ).append (forwardedPort );
474
479
}
480
+
475
481
String contextPath = request .getContextPath ();
476
482
if (contextPath != null ) {
477
483
sb .append (contextPath );
You can’t perform that action at this time.
0 commit comments