code: private StringBuilder getRequestURL(HttpServletRequest request) {
          String scheme = request.getScheme();
          int port = request.getServerPort();
          if (port < 0) {
              port = DEFAULT_PORT_NUMBER;
          }
  
          StringBuilder url = new StringBuilder();
          url.append(scheme);
          url.append("://");
          url.append(request.getServerName());
          if ((scheme.equals("http") && (port != DEFAULT_PORT_NUMBER))
                  || (scheme.equals("https") && (port != DEFAULT_SSL_PORT_NUMBER))) {
              url.append(':');
              url.append(port);
          }
          url.append(request.getRequestURI());
          return url;
      }
docs: In cases when {@link HttpServletRequest} is wrapped, request url will consist values from top wrapper now.
  Instead of schema, port and server name from inner {@link org.apache.coyote.Request}.
  Default case is when service is behind load balancer and {@link org.apache.catalina.filters.RemoteIpFilter}
  is used for X-Forwarded headers.
  
  @param request wrapped/original request.
  @return request URL based on values from wrapping Request.