1 Reply Latest reply on Feb 7, 2013 9:41 PM by Steve Schepp

    Dynamic Subdomains virtural-host

    Steve Schepp Newbie

      I'd like to know if you can configure Jboss as 7.1.1.final to support wildcard subdomains *.shop.dot.com?

       

      Example

       

      my.shop.dot.com

      sales.shop.dot.com

      [Nth].shop.dot.com

       

      My DNS supports wildcard subdomains, so DNS points to the same IP no matter what the subdomain is (*.shop.dot.com).

       

      I've tried configuring standalone.xml with virtual-server but no luck.

       

      [standalone.xml file]

       

      <virtual-server name="my-host">

            <alias name="*.shop.dot.com"/>

      </virtual-server>

       

       

       

       

      Thanks in advance,

      Schepp

        • 1. Re: Dynamic Subdomains virtural-host
          Steve Schepp Newbie

          Hopefully this will help someone!!!

           

          After playing with it for days, I've managed to figure it out.  I think my problem was over thinking it.  Now I do not have my jboss front-ended with Apache or any other external web servers.

           

          Now JBoss serves my web app with the following dynamic subdomains:

           

          my.shop.example.com, this.shop.example.com, that.shop.example.com, *.shop.example.com.

           

          Please give thumbs up if it helps you.

           

          Steps to setup:

           

          1. I setup *.shop.mydomain.com in DNS
          2. Set the default-virtual-server to the virtual-server that I want the dynamic subdomains to go to. [in STANDALONE.xml file]
            Note: virutal-server does not have enable-welcome-root set, therefore it used the default which is FALSE
          3. Add jboss-web.xml to your WAR you want to serve as the dynamic subdomain web application

           

          Jboss answers all request sent in at the port number defined in your config.  If JBoss can't match the host in the http request to any alias defined in your virtual-server, it will serve the default-virutal-server.

           

          [STANDALONE.xml file in Jboss Config.]

          <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="dynamic-example-host" native="false">

                      <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>

                      <virtual-server name="default-host" enable-welcome-root="true">

                          <alias name="localhost"/>

                      </virtual-server>

                      <virtual-server name="dynamic-example-host">

                          <alias name="shop.mydomain.com"/>

                      </virtual-server>

          </subsystem>

           

          [JBOSS-WEB.xml file in WAR]

          <?xml version="1.0" encoding="UTF-8"?>

          <jboss-web>

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

              <virtual-host>dynamic-example-host</virtual-host>

          </jboss-web>