Skip to content

Commit 4265630

Browse files
committed
Update GrailsWebRequest
to read the PORT information from the request header when it is missing in the request. This fixes #12816 where application is accesed via AWS's ALB.
1 parent 82181d6 commit 4265630

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: grails-web-common/src/main/groovy/org/grails/web/servlet/mvc/GrailsWebRequest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ public String getBaseUrl() {
466466
StringBuilder sb=new StringBuilder();
467467
sb.append(scheme).append("://").append(request.getServerName());
468468

469-
int port = request.getServerPort();
469+
int port = request.getServerPort() ?: request.getHeader("X-Forwarded-Port");
470470

471471
//ignore port append if the request was forwarded from a VIP as actual source port is now not known
472472
if (forwardedScheme == null && (("http".equals(scheme) && port != 80) || ("https".equals(scheme) && port != 443))) {

0 commit comments

Comments
 (0)