webjbossjboss6.xcontextroot

Multiple Context path for the same war in jboss


I am deploying my web app in jboss-EAP-6.1

I would like to have different context path for the same war:

http://localhost:8080/path1/xyx

http://localhost:8080/path2/xyx

Can you please suggest me on how to do this?


Solution

  • Pin your application via jboss-web.xml to context-root path1 and add rewrite rule to standalone.xml as shown:

    <virtual-server name="default-host" enable-welcome-root="false">
      <alias name="localhost"/>
      <rewrite name="rule-1" pattern="^/path1(.*)$" substitution="/path2/$1" flags="NC"/>
    </virtual-server>