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

后端 未结 3 1112
暖寄归人
暖寄归人 2021-01-13 11:05

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

相关标签:
3条回答
  • 2021-01-13 11:44

    I tested a setup similar to yours on Ubuntu 14.04 with WildFly 8.1.0.Final and Firefox 30, and for me, it works after adding a WEB-INF/jboss-web.xml to one my wars:

    <jboss-web>
        <virtual-host>other-host</virtual-host>
    </jboss-web>
    

    I defined two different host aliases for the same IP in my /etc/hosts, and my browser gets redirected to the different web apps for http://alias1:8080 and http://alias2:8080 as expected.

    0 讨论(0)
  • 2021-01-13 11:49

    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.

    I created https://issues.jboss.org/browse/WFLY-3639 to track & fix it.

    as a workaround until this is fixed add

    jboss-web.xml to WEB-INF of your myapp2.war

    with content:

    <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.

    0 讨论(0)
  • 2021-01-13 11:52

    default-host is the virtual host that will be used if an incoming request as no Host: header. So to get the requests to your other server, the request sent by the client should have "Host: other-host" in the request header.

    A sample HTTP request from client looks like,

    GET /Some/Resource HTTP/1.1
    Accept: ....
    Host: other-host
    ....
    ....
    

    See if this works.

    0 讨论(0)
提交回复
热议问题