野蝇->暗流->将子域映射到战争文件不起作用 [英] WildFly -> Undertow -> mapping subdomain to war file not working
问题描述
WildFly 8.1.0 决赛Windows Server 2012 R2
WildFly 8.1.0 Final Windows Server 2012 R2
我有两个子域指向这个服务器,我希望对每个子域的请求触发不同的战争文件:-
I have two sub-domains pointing at this server, and I want requests to each sub-domain to trigger a different war file:-
webapp.domain1.com -> WildFly Server -> myapp1.war
test.domain2.net -> WildFly Server -> myapp2.war
我的 standalone.xml 文件目前根据 JBoss Developer 站点上收到的建议配置如下:-
My standalone.xml file is currently configured as follows based on advice received on the JBoss Developer site:-
<subsystem xmlns="urn:jboss:domain:undertow:1.1">
<buffer-cache name="default"/>
<server name="default-server">
<http-listener name="default" socket-binding="http"/>
<host name="default-host" default-web-module="myapp1.war" alias="webapp.domain1.com"/>
<host name="other-host" default-web-module="myapp2.war" alias="test.domain2.net"/>
</server>
<servlet-container name="default">
<jsp-config/>
</servlet-container>
<filters>
<response-header name="server-header" header-value="WildFly/8" header-name="Server"/>
<response-header name="x-powered-by-header" header-value="Undertow/1" header-name="X-Powered-By"/>
</filters>
</subsystem>
将浏览器指向 webapp.domain1.com 或 test.domain2.net 会导致请求按预期发送到 WildFly 服务器,但在这两种情况下都会触发相同的 war 文件 (myapp1.war).
Pointing a browser at webapp.domain1.com or test.domain2.net results in the request being sent to the WildFly server as expected, but the same war file (myapp1.war) is triggered in both cases.
切换<host .../>的'name'值以下元素会导致 myapp2.war 被调用,无论使用哪个 URL:-
Switching the 'name' values of the <host .../> elements as follows results in myapp2.war being called whichever URL is used:-
<host name="other-host" default-web-module="myapp1.war" alias="webapp.domain1.com"/>
<host name="default-host" default-web-module="myapp2.war" alias="test.domain2.net"/>
看起来 Undertow 只处理default-host"条目的详细信息.
It looks like Undertow is only processing details of the "default-host" entry.
这里有人可以帮忙吗?
如果做不到这一点,有谁知道 WildFly 是否(以及如何)可以与 Apache Web Server 一起使用?
Failing that, does anyone know if (and how) WildFly can be used with Apache Web Server?
推荐答案
这是当前 undertow 子系统实现中的一个错误.它只为默认主机正确处理 default-web-module,甚至不考虑非默认主机.
This is a bug in current undertow subsystem implementation. It only properly processes default-web-module for default host and doesn't even take it into account for non default hosts.
我创建了https://issues.jboss.org/browse/WFLY-3639 跟踪 &修复它.
I created https://issues.jboss.org/browse/WFLY-3639 to track & fix it.
作为解决方法,直到修复此问题添加
as a workaround until this is fixed add
jboss-web.xml
到你的 myapp2.war 的 WEB-INF
jboss-web.xml
to WEB-INF
of your myapp2.war
内容:
<jboss-web>
<virtual-host>other-host</virtual-host>
<context-root>/</context-root>
</jboss-web>
这将告诉服务器什么主机 &它应该绑定到上下文根.
which will tell server to what host & context root it should be bound to.
这篇关于野蝇->暗流->将子域映射到战争文件不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!