My tomcat process has -DcontextName=companyApp but I am unable to use this in my urlrewrite.xml file
<?xml version="1.0" encoding="utf-8"?>
<!--
Configuration file for UrlRewriteFilter
http://tuckey.org/urlrewrite/
-->
<urlrewrite use-query-string="true" default-match-type="wildcard">
<rule>
<from>${contextName}</from>
<to type="permanent-redirect" last="true">abc.com</to>
</rule>
</urlrewrite>
the redirect does not work. I think the ${contextName} is not getting resolved.
Note that I have set default-match-type="wildcard"
to remove any doubts about any clash with regex engine.
Edit: I also tried to use %{context-path}, which is a variable provided by url rewrite filter, to do the same job but that did not work either, which is why I am using this approach.
URLRewrite filter does not accept environment variables or any variable in the <from> block.