Configured server base url not considered in page creation

XMLWordPrintable

    • Type: Bug
    • Resolution: Not a bug
    • Priority: Medium
    • None
    • Affects Version/s: 2.2.9
    • Environment:

      Confluence is installed behind a reverse proxy which maps urls, read details in "description" section.
      Using Confluence WAR-Edition, JDK is 1.4.2

      Configured "Server Base Url" under Administration/General Configuration/Site
      Configuration as "https://volkswagen-tui-portal.web.vwg/wikis/confluence"

      Put confluence behind a reverse proxy (WebSeal) which performs a URL mapping
      like the following:
      From public URL:
      https://volkswagen-tui-portal.web.vwg/wikis/confluence/dashboard.action
      To non-public URL:
      https://devwagwoc38y650.wob.vw.vwg/confluence/dashboard.action

      Steps to reproduce the problem
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      To reproduce the error I pass the following steps:

      • Point your browser the public Confluence URL:
        https://volkswagen-tui-portal.web.vwg/wikis/confluence
      • Login
      • Go to Page "Dashboard" (necessary since this isn't the site homepage
        in our installation).
      • Click on the "My" spaces link.
      • An error message from the reverse proxy is shown:
        "The Access Manager WebSEAL server cannot find any resource matching
        the requested URL: /confluence/dashboard.action?spacesSelectedTab=my"

      Investigating the problem
      ^^^^^^^^^^^^^^^^^^^^^^^^^
      The Problem can be tracked down as follows:
      In the source-code of the dashboard page the "My"-Link is defined this way:
      <a href="#" onClick="gotoUrl('/confluence/dashboard.action?spacesSelectedTab=my'); return false;">My</a>
      When you click the My-Link the following URL gets called:
      https://volkswagen-tui-portal.web.vwg/confluence/dashboard.action?spacesSelectedTab=my

      You can see the cause of the problem here:
      The URL given in the Javascript-gotoUrl-command leads to the wrong path after
      the host name because the path component "wikis" is missing. The correct link
      should be
      <a href="#" onClick="gotoUrl(' https://volkswagen-tui-portal.web.vwg/wikis/confluence/dashboard.action?spacesSelectedTab=my'); return false;">My</a>
      that is, the configured property "server base url" should appear in it.

      Where does the wrong URL come from?
      When you search for the Velocity template which stands behind the dashboard
      page, you'll find the following file:
      confluence-2.2.9-source\confluence\src\webapp\template\xhtml\spacelist.vm

      In this spacelist.vm-file you'll find our link definition mentioned above in
      line 30:
      ... <a href="#" onClick="gotoUrl('${baseurl}spacesSelectedTab=my'); ...

      As you can see, our problematic URL part stems from the property ${baseurl}.

      Where gets the property baseurl defined?
      A little more research leads to this java class:
      /Confluence-2.2.9/src/java/com/atlassian/confluence/renderer/radeox/macros/AbstractHtmlGeneratingMacro.java

      In this class "AbstractHtmlGeneratingMacro" there is a method called
      "buildBaseUrl" which creates the baseurl used during page generation.
      Unfortunately, this method creates the baseurl by using the incoming
      HttpServletRequest's method "getRequestURI()". The returned URI is the one used
      on the actual confluence host after the URL mapping and this URI is invalid for
      using it on the front-side of the mapping i.e. before mapping URLs. This leads
      to the Webseal's error message shown above.

      Suggested solution
      ^^^^^^^^^^^^^^^^^^
      Instead of using the HttpServletRequest's method "getRequestURI()" for
      determining the baseUrl automatically from the incoming request, confluence
      should simply use the configured "Server Base Url" in method
      AbstractHtmlGeneratingMacro. buildBaseUrl(...).

      Workaround
      ^^^^^^^^^^
      Unfortunatly I didn't find any in confluence
      It seems that I'll have to change my public URL so that its path components match those of the non-public URL.

            Assignee:
            Unassigned
            Reporter:
            Stefan Prange
            Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: