code: protected String getBaseURL(HttpServletRequest request) {
  //        if (forcedBaseAddress != null) {
  //            return forcedBaseAddress;
  //        }
  
          String reqPrefix = request.getRequestURL().toString();
          String pathInfo = request.getPathInfo() == null ? "" : request.getPathInfo();
          //fix for CXF-898
          if (!"/".equals(pathInfo) || reqPrefix.endsWith("/")) {
              StringBuilder sb = new StringBuilder();
              // request.getScheme(), request.getLocalName() and request.getLocalPort()
              // should be marginally cheaper - provided request.getLocalName() does
              // return the actual name used in request URI as opposed to localhost
              // consistently across the Servlet stacks
  
              URI uri = URI.create(reqPrefix);
              sb.append(uri.getScheme()).append("://").append(uri.getRawAuthority());
  
              //No servletPath will be appended, as in Liberty, each endpoint will be served by one servlet instance
              sb.append(request.getContextPath());
  
              reqPrefix = sb.toString();
          }
          return reqPrefix;
      }
docs: Calculate the base URL based on the HttpServletRequest instance
  
  @param request
  @return