1 Reply Latest reply on Jan 8, 2018 7:57 AM by Erik .

    One .war file and two different domains

    Sarah Qu Newbie

      Dear all,

       

      I have the following question:
      I have one .war file with two different views (applications) for the end customer:

       

      Application1: A page to booking hotels etc.
      Application2: Manage the hotel booking etc. (more back end)

       

      Now my question:
      A think I can redirect the Domains to the different pages:
      DomainA -> Applications1

      DomainB -> Applications2

       

      But how?

      DomainA -> localhost:8080/customerEndView

      DomainB -> localhost:8080/backEnd

       

      But my URL should be like this:

      DomainA and only DomainB (without the folder names)

       

      For DomainA, i would like to use also domains for different languages:

      DomainA.uk

      DomainA.de

      ....

       

      Can anybody help here and give me some ideas, please

        • 1. Re: One .war file and two different domains
          Erik . Newbie

          One option is to build one ear for your application with two war modules.

           

          Add to your subsystem undertow config in the profile your using a host for each domain for example example1-host with alias example1.com and example2-host width alias example2.com

           <subsystem xmlns="urn:jboss:domain:undertow:4.0">
            ...
            <server name="default-server">
             ...
             <host name=example1-host" alias="example1.lan">
              <filter-ref name="server-header" priority="1"/>
              <filter-ref name="x-powered-by-header" priority="1"/>
             </host>
             <host name="example2-host" alias="example2.lan">
              <filter-ref name="server-header" priority="1"/>
              <filter-ref name="x-powered-by-header" priority="1"/>
             </host>
            </server>
            ...
           </subsystem>
          

           

          Then add to the first war META-INF/jboss-web.xml

          <?xml version="1.0" encoding="UTF-8"?>
          <jboss-web xmlns="http://www.jboss.com/xml/ns/javaee"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-web_11_0.xsd"
                     version="11.0">
              <context-root>/</context-root>
              <virtual-host>example1-host</virtual-host>
          </jboss-web>
          
          
          

           

          Then add to the second war META-INF/jboss-web.xml

          <?xml version="1.0" encoding="UTF-8"?>
          <jboss-web xmlns="http://www.jboss.com/xml/ns/javaee"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee http://www.jboss.org/j2ee/schema/jboss-web_11_0.xsd"
                     version="11.0">
              <context-root>/</context-root>
              <virtual-host>example2-host</virtual-host>
          </jboss-web>