1 Reply Latest reply on Jan 19, 2018 5:19 AM by rohitko

    Add alias for a single host in wildfly 10 without restarting it?

    rohitko

      I am working on multi tenant application and wanted to add alias for a host on the fly when new tenant gets added.

      e.g. tenant1.abc.com, while abc.com is fixed I just want to change tenant name.

      Every time when new tenant gets added to system I have to manually add it in standalone.full.ha.xml or standalone.xml and restart the wildfly instance.

      following is my config for this

      <subsystem xmlns="urn:jboss:domain:undertow:3.0">

                  <buffer-cache name="default"/>

                  <server name="default-server">

                      <ajp-listener name="ajp" socket-binding="ajp"/>

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

                      <host name="ABC" alias="tenant1.abc.com, tenant2.abc.com">

                          <location name="/ABCConsole" handler="ABCConsole"/>

                          <filter-ref name="server-header"/>

                          <filter-ref name="x-powered-by-header"/>

                      </host>

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

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

                          <filter-ref name="server-header"/>

                          <filter-ref name="x-powered-by-header"/>

                      </host>

                  </server>

                  <servlet-container name="default">

                      <jsp-config/>

                      <websockets/>

                  </servlet-container>

                  <handlers>

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

                      <file name="ABCConsole" path="${jboss.home.dir}/standalone/deployments"/>

                  </handlers>

                  <filters>

                      <response-header name="server-header" header-name="Server" header-value="WildFly/10"/>

                      <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>

                  </filters>

              </subsystem>

      And my jboss-web.xml

      <jboss-web>

           <virtual-host>OpsTrakker</virtual-host>

      <context-root>/ABCConsole</context-root>

      </jboss-web>

        • 1. Re: Add alias for a single host in wildfly 10 without restarting it?
          rohitko

          I found Solution,

           

          Check following configuration,

           

          <host name="ABC" alias=".abc.com">

                              <location name="/ABCConsole" handler="ABCConsole"/>

                              <filter-ref name="server-header"/>

                              <filter-ref name="x-powered-by-header"/>

            </host>

          <host name="default-host" alias="localhost, .abc.com">

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

                              <filter-ref name="server-header"/>

                              <filter-ref name="x-powered-by-header"/>

          </host>