WildFly->底线->将子域映射到War文件不起作用 [英] 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
我有两个指向此服务器的子域,并且我希望对每个子域的请求触发一个不同的war文件:-
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仅在处理默认主机"条目的详细信息.
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
到WEB-INF
内容:
<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.
这篇关于WildFly->底线->将子域映射到War文件不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!