Wildfly Virtual Host Setup

Follow the next standalone.xml setup in order to configure more domain (i.e testfoo.com, localhost).
You have to add in undertow subsystem other <host ..> tag (see the green code)

<subsystem xmlns="urn:jboss:domain:undertow:1.1">
           <buffer-cache name="default"/>
           <server name="default-server" >
               <http-listener name="default" socket-binding="http"/>
               <https-listener name="https-listener" socket-binding="https" security-realm="MySecurityRealm"/>
               <host name="default-host" alias="localhost">
                   <location name="/" handler="welcome-content"/>
                   <filter-ref name="server-header"/>
                   <filter-ref name="x-powered-by-header"/>
               </host>
               <host name="testfoo" alias="testfoo.com">
                   <location name="/" handler="welcome-content-foo"/>
                   <filter-ref name="server-header"/>
                   <filter-ref name="x-powered-by-header"/>
               </host>
           </server>
           <servlet-container name="default" default-encoding="utf-8">
               <jsp-config/>
           </servlet-container>
           <handlers>
               <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
               <file name="welcome-content-foo" path="${jboss.home.dir}/welcome-content-foo"/>
           </handlers>
           <filters>
               <response-header name="server-header" header-name="Server" header-value="WildFly/8"/>
               <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
           </filters>
       </subsystem>

In this example we make 2 welcome content handlers in order to make two welcome content directory each for the different host.


No comments: