docs: private String getProxyURL(HttpServletRequest httpServletRequest,
                                 History history, Integer requestType) throws Exception {
          // first determine if Odo will even fully handle this request
          RequestInformation requestInfo = requestInformation.get();
          if (ServerRedirectService.getInstance().canHandleRequest(HttpUtilities.getHostNameFromURL(
              httpServletRequest.getRequestURL().toString()))) {
              requestInfo.handle = true;
          }
  
          String stringProxyURL = "http://";
  
          // determine http vs https
          String originalURL = httpServletRequest.getRequestURL().toString();
          history.setOriginalRequestURL(originalURL);
          if (originalURL.startsWith("https://")) {
              stringProxyURL = "https://";
          }
  
          String hostName = HttpUtilities.getHostNameFromURL(originalURL);
          int port = HttpUtilities.getPortFromURL(originalURL);
  
          String origHostName = hostName;
          logger.info("original host name = {}", hostName);
  
          processClientId(httpServletRequest, history);
  
          String queryString = httpServletRequest.getQueryString();
          if (queryString == null) {
              queryString = "";
          } else {
              queryString = "?" + queryString.replace("|", "%7C").replace("[", "%5B").replace("]", "%5D");
          }
  
          // if this can't be overridden we are going to finish the string and bail
          if (!requestInfo.handle) {
              stringProxyURL = stringProxyURL + hostName + ":" + port;
  
              // Handle the path given to the servlet
              stringProxyURL += httpServletRequest.getPathInfo();
              stringProxyURL += queryString;
  
              return stringProxyURL;
          }
  
          // figure out what profile to use based on source server name and matching paths
          // if no profile has matching paths then we just pick the first enabled one
          // if no profile is enabled then we pick the first one so that we have a URL mapping
          for (Profile tryProfile : ServerRedirectService.getInstance().getProfilesForServerName(origHostName)) {
              logger.info("Trying {}", tryProfile.getName());
              Client tryClient = ClientService.getInstance().findClient(history.getClientUUID(), tryProfile.getId());
              if (tryClient == null) {
                  continue;
              }
  
              List<EndpointOverride> trySelectedRequestPaths = PathOverrideService.getInstance().getSelectedPaths(Constants.OVERRIDE_TYPE_REQUEST, tryClient,
                                                                                                                  tryProfile, httpServletRequest.getRequestURL() + queryString, requestType, false);
              List<EndpointOverride> trySelectedResponsePaths = PathOverrideService.getInstance().getSelectedPaths(Constants.OVERRIDE_TYPE_RESPONSE, tryClient,
                                                                                                                   tryProfile, httpServletRequest.getRequestURL() + queryString, requestType, false);
              logger.info("Sizes {} {}", trySelectedRequestPaths.size(), trySelectedResponsePaths.size());
              if ((trySelectedRequestPaths.size() > 0 || trySelectedResponsePaths.size() > 0) ||
                  tryClient.getIsActive() || requestInfo.profile == null) {
                  logger.info("Selected {}, {}, " + httpServletRequest.getRequestURL() + "?" +
                                  httpServletRequest.getQueryString(), tryProfile.getName(), tryClient.getId());
                  // reset history UUID based on client
                  history.setClientUUID(tryClient.getUUID());
  
                  requestInfo.profile = tryProfile;
                  requestInfo.selectedRequestPaths = new ArrayList<EndpointOverride>(trySelectedRequestPaths);
                  requestInfo.selectedResponsePaths = new ArrayList<EndpointOverride>(trySelectedResponsePaths);
                  requestInfo.client = tryClient;
              }
          }
  
          // we always should do this mapping since a request coming through us means it was redirected..
          // don't want to cause a loop
          hostName = getDestinationHostName(hostName);
  
          logger.info("new host name = {}", hostName);
  
          stringProxyURL = stringProxyURL + hostName;
  
          // Handle the path given to the servlet
          stringProxyURL += httpServletRequest.getPathInfo();
          stringProxyURL += processQueryString(queryString).queryString;
          logger.info("url = {}", stringProxyURL);
  
          history.setProfileId(requestInfo.profile.getId());
          return stringProxyURL;
      }