2

This is related to two posts -

Hosting multiple domains with WildFly (Undertow),

WildFly -> Undertow -> maping subdomain to war file not working

The workaround with creating/editing jboss-web.xml does not seem to be working.

I tried this workaround for my scenario where two virtual hosts are served exactly with the same WAR files, with no context-root configuration.

In wildfly/standalone/configuration/standalone.xml:

<host name="domain1" alias="domain1.rootdomain.com">
    <location name="/" handler="welcome-content"/>
    <filter-ref name="server-header"/>
    <filter-ref name="x-powered-by-header"/>
</host>
<host name="domain2" alias="domain2.rootdomain.com">
    <location name="/" handler="welcome-content"/>
    <filter-ref name="server-header"/>
    <filter-ref name="x-powered-by-header"/>
</host>

In jboss-web.xml:

<jboss-web>
  <virtual-host>domain1</virtual-host>
  <virtual-host>domain2</virtual-host>
</jboss-web>

During deploy/redeploy Wildfly complains that already one virtual-host tag was processed and the deployment/redeployment fails.

Is there any other solution for this problem?

Community
  • 1
  • 1
GPN
  • 53
  • 1
  • 7

1 Answers1

1

I had the same problem for long time ago. My solution was to "merge" two host configurations in a single one, like:

<host name="domains1and2" alias="domain1.rootdomain.com, domain2.rootdomain.com">
    <location name="/" handler="welcome-content"/>
    <filter-ref name="server-header"/>
    <filter-ref name="x-powered-by-header"/>
</host>

And then in jboss-web.xml:

<jboss-web>
  <virtual-host>domain1and2</virtual-host>
</jboss-web>
Korvin
  • 35
  • 1
  • 7