Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-1898

WebRequestCycleProcessor.resolveHomePageTarget for empty path with enforceMounts=true provokes 403 - "Direct access not allowed for mounted targets"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.4-M3
    • 1.4-RC2
    • wicket
    • None
    • Wicket 1.4-m3

    Description

      Scenario: WebApplication.getHomePage() returns a page that is also mounted to a non-empty path by WebApplication.mountBookmarkablePage(). Besides, we have getSecuritySettings().setEnforceMounts(true). Upon a request for the servlet's root URL (i.e., with requestParameters.getPath()==""), the method
      WebRequestCycleProcessor.resolve will throw a AbortWithWebErrorCodeException(403) with error message "Direct access not allowed for mounted targets".

      This is because WebRequestCycleProcessor.resolveHomePageTarget correctly returns a non-null target, so that the else-branch starting in line 190 of file WebRequestCycleProcessor.java is reached.

      The comment says "a target was found, but not by looking up a mount", which is misleading, because the szenario should desirably work even though property enforceMounts has been set to true.

      The only (terrible) workaound I have found is to override WebRequestCycleProcessor.resolveHomePageTarget() to return null and establish a home-page-like thing by overriding WebRequestCodingStrategy.urlCodingStrategyForPath() for the empty path.

      Attachments

        Activity

          People

            ivaynberg Igor Vaynberg
            olivermatz Oliver Matz
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: