Search code examples
jbosswebserverwildflyapplication-serverundertow

Undertow: Static root-content outside of WAR-file (wildfly)


I have the following problem, which makes me going nuts:

I want to configure my Undertow-Subsystem of my Wildfly 10.0.0 Final app-server, so it can handle static content on root (/) while a WAR-file is deployed.

When no WAR is deployed, it shows the welcome-content, as configured in the standalone.xml:

<location name="/" handler="welcome-content"/>

and

<file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>

As soon as my WAR is deployed, no more welcome-content is shown. Until now, exactly, what i wanted. Now i want to extract our angular-client to a seperate directory, lets say /home/user/awesomeClientDir.

I tried adding a new location and file-handler, which works nicely in a subpath like www.website.com/subpath/index.html

As soon as i configure the path to /, no matter if my welcome-content is still in my standalone.xml or not, the WAR-file removes the ability to access my static content.

I have absolutely no idea, how i can achieve this... The web.xml in my WAR hooks my API into the /rest subpath, wich works great in any case, but my static content just won't be available at / (403 / 404 depending on constellation)

Any help or hint will be appreciated, the struggle is real with this one!


Solution

  • You should bind deploy your application (war) to /rest and have the resteasy application listen to root of that application.

    This way undertow subsystem can still handle / resource and all others (but /rest) with static content handler (or any other if you want)