Multiple Context path for different war in WildFly

438 views Asked by At

I am deploying my web app in WildFly 23.0.0 Final and I'm using spring application.

I would like to have different Context path for the diffrent war in one deploy:

http://ip:8080/xxx-ui

http://ip:8080/xxx-rest

http://ip:8080/xxx-cron

Can someone show me how to do this ?

1

There are 1 answers

0
Matruskan On

WildFly has Undertow's filter/rewrite.

First, you add an "xxx" filter for the URLs you want. For example, filter request with /xxx-*. The jboss.cli command is as follows:

/subsystem=undertow/server=default-server/host=default-host/filter-ref=xxx:add(predicate="regex('/xxx-(.*)')")

Then, you add the rewrite/filter. In this example, the request could go to "/xxx" (the EAR's context path) plus the WAR's context path.

/subsystem=undertow/configuration=filter/rewrite=xxx:add(target="/xxx/$${1}")

As a side note, it looks like a job for a load balancer, or some other network-related application, like HAProxy, Apache or AWS Cloud Front