-
1. Re: Dynamic Subdomains virtural-host
scheppsr77 Feb 7, 2013 9:41 PM (in response to scheppsr77)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:
- I setup *.shop.mydomain.com in DNS
- 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 - 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>