Uploaded image for project: 'EJBCA'
  1. EJBCA
  2. ECA-4729

getRequestServerName with ejbca behind a reverse proxy via ajp returns wrong server name

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: EJBCA 6.14.0
    • Component/s: CA GUI
    • Labels:
      None
    • Environment:
      ubuntu 14.04; java 1.8.0_66; apache 2.4, wildfly 9, ejbca 6.3.3.1
    • Issue discovered during:
      Community
    • Sprint:
      EJBCA Sprint 13

      Description

      We have ejbca running in wildfly 9 behind a apache reverse proxy. The apache is connected with wildfly via proxy_ajp.

      The method getRequestServerName cuts the first 8 characters of the url but if there is another protocol than https it will not work anymore.

      I fixed it for me using a regex:

      96a97
      > private static java.util.regex.Pattern urlProto = java.util.regex.Pattern.compile("^.://(.?)/.*$");
      275,279c276,285
      < // Remove https://
      < requestURL = requestURL.substring(8);
      < int firstSlash = requestURL.indexOf("/");
      < // Remove application path
      < requestURL = requestURL.substring(0, firstSlash);

      > final java.util.regex.Matcher m = urlProto.matcher(requestURL);
      > if(m.matches() && m.groupCount() == 1)

      { > requestURL = m.group(1); > }

      else

      { > // Remove https:// > requestURL = requestURL.substring(8); > int firstSlash = requestURL.indexOf("/"); > // Remove application path > requestURL = requestURL.substring(0, firstSlash); > }

        Attachments

          Activity

            People

            • Assignee:
              tomas Tomas Gustavsson
              Reporter:
              ibruell Ingo Bruell
              Verified by:
              Samuel Lidén Borell
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 15 minutes
                15m
                Remaining:
                Remaining Estimate - 15 minutes
                15m
                Logged:
                Time Spent - Not Specified
                Not Specified