-
1. Re: Undertow - Point a subdomain at a virtual host
ctomc Jun 12, 2014 5:34 AM (in response to andy56_uk)Hi,
just add another <host name="name-of-other-host" alias="my.other.domain, second.tld">
element and which has extra alias(es) that you want
you can also add default-web-module="my-other.war" and that will be it.
<host name="name-of-other-host" alias="
other.maindomain.com
" default-web-module="otherwebsite.war
" /><host name="product" alias="
productdomain.net
" default-web-module="product.war
" />etc
for more advanced mapping from your war to virtual host, you can add jboss-web.xml to your WEB-INF
with contents like:
<?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/schema/jbossas/jboss-web_8_0.xsd"
version="7.1">
<context-root>/</context-root>
<virtual-host>context-host</virtual-host>
</jboss-web>
-
2. Re: Re: Undertow - Point a subdomain at a virtual host
andy56_uk Jun 13, 2014 5:56 AM (in response to ctomc)Hi Tomaz,
Thanks for taking the time to help with this.
I had already found your first suggestion in a reply that you had made to another user, but it doesn't work for me.
In standalone.xml I have:-
<server name="default-server"> <http-listener name="default" socket-binding="http"/> <host name="default-host" alias="webapp.maindomain.com" default-web-module="website.war"/> <host name="product-host" alias="test.productdomain.net" default-web-module="product.war"/> </server>
On the name server for maindomain.com I have the following A record:-
Subdomain = webapp
Address = <ip_address_of_wildfly_server>
On the name server for productdomain.com I have the following A record:-
Subdomain = test
Address = <ip_address_of_wildfly_server>
Pointing a browser at webapp.maindomain.com results in website.war being called as expected, but pointing a browser at test.productdomain.net also results in website.war being called - I was expecting product.war to be called.
Both applications are deployed and enabled on the WildFly server, and if I point my browser at webapp.maindomain.com/product or test.productdomain.net/product then product.war is called.
In order to try your second suggestion of adding a jboss-web.xml file to WEB-INF, what values should I use in the following fields for the two sub-domains?
<context-root>/</context-root> <virtual-host>context-host</virtual-host>
Many thanks,
Andy
-
3. Re: Re: Undertow - Point a subdomain at a virtual host
andy56_uk Jun 26, 2014 6:48 AM (in response to andy56_uk)HI,
Can anyone offer any advice on how to get this working with Undertow please?
Failing that, is it possible to use WildFly with Apache Web Server instead of Undertow?
Thanks,
Andy
-
4. Re: Undertow - Point a subdomain at a virtual host
andy56_uk Jun 27, 2014 8:18 AM (in response to ctomc)After further investigation I've found that switching the 'name' value of the <host .../> elements as follows results in product.war being called whichever URL is used:-
<host name="product-host" alias="webapp.maindomain.com" default-web-module="website.war"/>
<host name="default-host" alias="test.productdomain.net" default-web-module="product.war"/>
It looks like Undertow is only processing details of the "default-host" entry.
Any suggestions please?
Andrew
-
5. Re: Undertow - Point a subdomain at a virtual host
auzy Feb 2, 2017 11:58 AM (in response to andy56_uk)Hi Andrew,
I'm running into the same issue on Wildfly10.1. I can't seem to get a 2nd host to work. Did you ever get this working and have any suggestions?
Thanks,
Eric
-
6. Re: Undertow - Point a subdomain at a virtual host
ctomc Feb 6, 2017 9:00 AM (in response to auzy)Eric Austman wrote:
Hi Andrew,
I'm running into the same issue on Wildfly10.1. I can't seem to get a 2nd host to work. Did you ever get this working and have any suggestions?
Thanks,
Eric
It will work just fine if you add jboss-web.xml as described.
OOTB solution that would take default-web-module attribute is fixed in master and will be part of WildFly 11