Hi everyone
I’m porting an application from CommondBox + Undertow to Tomcat 8.5.
I have a problem with Url Rewriting: Tomcat appears to behave differently than Undertow.
While with Undertow it works flawlessly, under Tomcat I always get a 404 error.
I have created a small application for isolating and debug the problem (In my main application I have multiple Coldboxes inside “apps” directory). If you need it, I can let you download it.
This is structure:
I configure urlrewrite.xml like this:
<rule>
<condition type="request-uri" operator="notequal">/(index.cfm[...]).*</condition>
<condition type="request-filename" operator="notdir"/>
<condition type="request-filename" operator="notfile"/>
<from>^/manager/(.+)$</from>
<to type="passthrough">/apps/manager/index.cfm/$1</to>
</rule>
I added this to my /WEB-INF/web.xml for Tomcat:
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
<init-param>
<param-name>logLevel</param-name>
<param-value>DEBUG</param-value>
</init-param>
<init-param>
<param-name>confReloadCheckInterval</param-name>
<param-value>1</param-value>
</init-param>
<init-param>
<param-name>confPath</param-name>
<param-value>/config/urlrewrite.xml</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>UrlRewriteFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
All rewritten urls work, except for Coldbox: I’ve got little rule for prevent cache assets that works like a charm.
In log file i see that the filter is correctly applied:
[...] org.tuckey.web.filters.urlrewrite.RuleBase DEBUG: conditions match
[...] org.tuckey.web.filters.urlrewrite.substitution.MatcherReplacer DEBUG: found 1
[...] org.tuckey.web.filters.urlrewrite.substitution.MatcherReplacer DEBUG: replaced sb is /apps/manager/index.cfm/user/new
[...] org.tuckey.web.filters.urlrewrite.RuleExecutionOutput DEBUG: needs to be forwarded to /apps/manager/index.cfm/user/new
Any idea?
OS: Windows
Java Version: Java 8
Tomcat Version: Tomcat 8.5
Lucee Version: 5.3.8.201