Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-56032

HttpUtil.normalizePath(uri) returns empty string for path /

    Details

      Description

      HttpUtil.normalizePath(uri) converts SLASH (/) path to a blank string. This causes that filters with <url-pattern>/</url-pattern> mapping won't be invoked.

      Steps to reproduce:

      1. In liferay-web.xml change the lines:
        	<filter-mapping>
        		<filter-name>Valid Host Name Filter</filter-name>
        		<url-pattern>/*</url-pattern>
        	</filter-mapping>
        

        to:

        	<filter-mapping>
        		<filter-name>Valid Host Name Filter</filter-name>
        		<url-pattern>/</url-pattern>
        	</filter-mapping>
        
      2. Copy log4j.dtd from /WEB-INF/lib/portal-impl.jar/META-INF/ to /WEB-INF/classes/META-INF/
      3. Create portal-log4j-ext.xml with below content in /WEB-INF/classes/META-INF/
        <?xml version="1.0"?>
        <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
        
        <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
        	<category name="com.liferay.portal.kernel.servlet.filters.invoker.FilterMapping">
        		<priority value="DEBUG" />
        	</category>
        </log4j:configuration>
        
      4. Start the portal and go to http://localhost:8080

      Expected result: Log contains line like:

      09:50:07,196 DEBUG [http-bio-8080-exec-1][FilterMapping:80] class com.liferay.portal.servlet.filters.validhostname.ValidHostNameFilter has a pattern match with /

      Actual result: Log contains line like:

      10:13:14,488 DEBUG [http-bio-8080-exec-1][FilterMapping:80] class com.liferay.portal.servlet.filters.validhostname.ValidHostNameFilter does not have a pattern match with 

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              yvonne.han Yvonne Han
              Reporter:
              istvan.sajtos Istvan Sajtos
              Participants of an Issue:
              Recent user:
              Istvan Sajtos
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                6 years, 13 weeks ago

                  Packages

                  Version Package
                  6.2.4 CE GA5
                  6.2.X EE
                  7.0.0 M6