2017  Kodetalk | Feedback | Privacy Policy | Terms | About

How to configure static contents in wildfly server

How can we configure Wildfly/Undertow in order to serve these files (/var/files) on a certain URL, for example http://localhost:8080/myapplication/filename?


Add another file handler and another location to the undertow subsystem in standalone.xml:

<server name="default-server">

   <http-listener name="default" socket-binding="http"/>

   <host name="default-host" alias="localhost">

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

       <location name="/fil" handler="file"/>




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

   <file name="files" path="/var/files" directory-listing="true"/>


Answer is