4

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?

Arpit Aggarwal
  • 27,626
  • 16
  • 90
  • 108
Balaji V
  • 918
  • 3
  • 10
  • 28

1 Answers1

6

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>
Alex Gläser
  • 126
  • 1
  • 3
  • 1
    I tried this with jboss AS 7, and I had two errors, first one was unrecognized attribute 'name', which I fixed by just removing the name attribute from the rewrite node, then it deployed successfully but the rewrite failed because it was appending // after the path2 so I had to remove the / between path2 and $1 the final configuration was this: after this it was all successful and working perfectly... so thank you for the tip! – Nawar Khoury Aug 10 '17 at 08:52