[jboss-jira] [JBoss JIRA] (WFLY-4001) Virtual host in jboss-web.xml doesn't work

I J (JIRA) issues at jboss.org
Mon Oct 30 16:13:00 EDT 2017


    [ https://issues.jboss.org/browse/WFLY-4001?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13483654#comment-13483654 ] 

I J commented on WFLY-4001:
---------------------------

Hi T. Cerar,

This does not work correctly in WildFly 10.1 Final:

The following is a post I just created in the forums.  Could you please comment?

link:  https://developer.jboss.org/message/977501#977501

Hi All,

A little help would be greatly appreciated.

My configuration:

=========  standalone-full.xml ===============
<subsystem xmlns="urn:jboss:domain:undertow:3.1">
  <buffer-cache name="default"/>
  <server name="default-server">
     <http-listener name="default" socket-binding="http" redirect-socket="https" enable-http2="true"/>
     <https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
     <host name="default-host" alias="localhost">
          <location name="/" handler="welcome-content"/>
           <filter-ref name="server-header"/>
           <filter-ref name="x-powered-by-header"/>
      </host>
      <host name="host1" alias="domain1.com,www.domain1.com" default-web-module="domain1-war.war"/>
      <host name="host2" alias="domain2.com,www.domain2.com" default-web-module="domain2-war.war"/>
    </server>
    <servlet-container name="default">
         <jsp-config/>
         <websockets/>
     </servlet-container>
     <handlers>
          <file name="welcome-content" path="${jboss.home.dir}/www/welcome-content"/>
     </handlers>
     <filters>
          <response-header name="server-header" header-name="Server" header-value="WildFly/10"/>
          <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
     </filters>

</subsystem>

============ /etc/hosts ============

127.0.0.1     localhost  host1 host2

=========== domain1-war/WEB-INF/jboss-web.xml =========

<jboss-web>

    <virtual-host>host1</virtual-host>

    <context-root>/</context-root>

</jboss-web>

=========== domain2-war/WEB-INF/jboss-web.xml =========

<jboss-web>

    <virtual-host>host2</virtual-host>

    <context-root>/</context-root>

</jboss-web>

[EDIT] ============================================

Wildfly is launched as per:   [opt/wildfly/bin]  ./standalone.sh -b=0.0.0.0 -c=standalone-full.xml

Thus socket bindings should not be an issue.


Notes:

1.  Server starts and all deploys and works as expected when access as host1:8080, host2:8080, localhost:8080
     Thus my webapps along with the wildfly default ROOT.war (welcome pages) work as expected.

2.  Router port 80 is forwarded to 8080

3.  When using the server aliases as defined in standalone-full.xml, in my case domain1.com or domain2.com the server times out and I get nothing.

4.  I have intercepted the request headers for domain1.com and domain2.com and they are correct.

Questions:

1.  Why does wildfly not take the alias reference for the local host1 or host2 domain, that being the request host token, and serve up the appropriate webapp?

2.  What am I doing incorrectly here?  Seems this should be simple to configure?

Thanks You in advance for any and all help! 

> Virtual host in jboss-web.xml doesn't work
> ------------------------------------------
>
>                 Key: WFLY-4001
>                 URL: https://issues.jboss.org/browse/WFLY-4001
>             Project: WildFly
>          Issue Type: Task
>          Components: Web (Undertow)
>    Affects Versions: 9.0.0.Alpha1
>            Reporter: Jim Ma
>            Assignee: Tomaz Cerar
>         Attachments: host.war
>
>
> Define the following configuration for undertow subsystem and deploy the attached host.war with virtual host  "vhost2" metada in jboss-web.xml. 
> {code:xml}
>       <subsystem xmlns="urn:jboss:domain:undertow:2.0">
>             <buffer-cache name="default"/>
>             <server name="default-server">
>                 <http-listener name="default" socket-binding="http"/>
>                 <host name="default-host" alias="localhost">
>                     <location name="/" handler="welcome-content"/>
>                     <filter-ref name="server-header"/>
>                     <filter-ref name="x-powered-by-header"/>
>                 </host>
>             </server>
>             <server name="undertow-server2">
>                 <http-listener name="listener2" socket-binding="http2"/>
>                 <host name="vhost2" alias="localhost4">
>                     <location name="/" handler="welcome-content2"/>
>                     <filter-ref name="server-header"/>
>                     <filter-ref name="x-powered-by-header"/>
>                 </host>
>             </server>
>             <servlet-container name="default">
>                 <jsp-config/>
>             </servlet-container>
>             <handlers>
>                 <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
>                 <file name="welcome-content2" path="${jboss.home.dir}/welcome-content2"/>
>             </handlers>
>             <filters>
>                 <response-header name="server-header" header-name="Server" header-value="WildFly/9"/>
>                 <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
>             </filters>
>         </subsystem>
> {code}
> Deploy is failed with error message : 
> 14:37:27,092 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "host.war")]) - failure description: {"WFLYCTL0180: Services with missing/unavailable dependencies" => [
>     "jboss.undertow.deployment.default-server.vhost2./host is missing [jboss.undertow.server.default-server.vhost2]",
>     "jboss.undertow.deployment.default-server.vhost2./host.UndertowDeploymentInfoService is missing [jboss.undertow.server.default-server.vhost2]"
> ]}



--
This message was sent by Atlassian JIRA
(v7.5.0#75005)


More information about the jboss-jira mailing list