6 Replies Latest reply on Mar 14, 2004 3:06 AM by Erik Sliman

    Virtual Host Aliases

    roger.t Newbie

      in the jboss-web.xml you can specify a virtual host for your application allowing the server to support multiple domains.

      However in Apache and Tomcat each virtual host can have many aliases.

      eg. fred.org , fred.co.uk, fred.gb.com all served by one application

      Can you do this in jboss?

        • 1. Re: Virtual Host Aliases
          Erik Turesson Novice


          I do not think your the answer to your question is depending on Jboss.

          If you use Jboss together with Jetty you can specify several virtual hosts for one application in the jetty-web.xml file.

          For other webbservers there are probably other ways to specify it, if the webbserver supports it.


          • 2. Re: Virtual Host Aliases
            Nikos Paraskevopoulos Newbie

            It is possible in JBoss-Tomcat bundle too.

            For JBoss 3.2.x look for server/<your-configuration>/deploy/jbossweb-tomcat.sar/META-INF/jboss-service.xml, element . The tomcat configuration is in there, exactly the same as in the standalone tomcat.

            If you are using JBoss 3.0.x, the same configuration can be found in server/<your-configuration>/conf/jboss-service.xml, if I remember well.

            • 3. Re: Virtual Host Aliases
              Frode Halvorsen Newbie


              I have succesfully set up my JBoss 3.2 with Tomcat to serve different EAR's for different host-names.

              This works fine as long as I map only one virtual-host-name per web-app, and all the rest goes to one unspecified one.

              I would like however to be able to specify 2 or 3 virtual-hosts (w1.test.fau.no , w2.test.fau.no and w3.test.fau.no) to one webapp at the same time as I have several oother web-apps that serves one or more virtual-hosts each.

              The server complains if I create more that one <virtual-server> in the jboss-web.xml

              Does anyone know how to acheve this ?

              • 4. Virtual Host Aliases SOLUTION
                Frode Halvorsen Newbie

                The solution was at Tomcat's own pages.

                The tomcat-config creates the virtual-hosts with HOST="hostname", which is the same name yoy must refer to in the jboss-web.xml. This does not have to be a valid name, just an internal name.

                Then you specify "www.realhost.com" as an alias in the tomcat-config, and you can specify as many aliases as you want mapped to each webapp.

                If you hav one webapp without any <virtual-host> this gets 'the rest'.

                • 5. Re: Virtual Host Aliases
                  Erik Sliman Apprentice

                  In Tomcat, I have not been able to get it to recognize any of the aliases (JBoss 3.2.3). It only seems to works with the value I put in the host name:

                   <Host name="thisworks">

                  When I enter an alias for the url in the web browser, JBoss/Tomcat appears to try to look for that context in localhost:

                  02:53:28,461 INFO [Engine] StandardHost[localhost]: MAPPING configuration error for request URI /the-app

                  Since the application is tied to the "thisworks" virtual host, it is no longer available in localhost, but is available under http://thisworks/the-app, but is not available under http://this.does.not.work/the-app. Thus, virtual hosting appears to be working, but aliases are not.

                  Am I doing something wrong?

                  • 6. Re: Virtual Host Aliases
                    Erik Sliman Apprentice

                    It works now that I capitalized the Alias tags. In other words:

                     <Host name="thisworks">