1 Reply Latest reply on Jun 5, 2014 5:43 PM by skay088 Branched from an earlier discussion.

    Re: Undertow - 2 hosts / sockets serving same container

    ctomc

      what you have now is correct.

       

      both listeners (ports) serve both hosts.

       

      so if you go trough one or another and access default-host you will have header set.

       

      but if you will access your default-host2 it will not (or what ever you configure)

      to make sure you are accessing right one, you need to access it differently, via "localhost2" (assuming you have it aliased also to 127.0.0.1 on your machine)

      instead of localhost.

       

      another option you use is to completely separate hosts & listeners, by adding extra "<server>" that has its own listeners and own hosts(also its own default host).

       

      it is just question of granularity what you want.

        • 1. Re: Undertow - 2 hosts / sockets serving same container
          skay088

          Ok, I changed to 2 servers / separating http listenres :

           

          <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="default-server2">

                          <http-listener name="default2" socket-binding="http2"  />   

                          <host name="default-host2" alias="localhost2" default-web-module="engine.war">

                               <location name="/" handler="welcome-content"/>

                              <filter-ref name="server-header" />

                          </host>

                      </server>   

          localhost:8080/engine is OK

          AND this is serving localhost2:8081 static content removing the x-powered-by-header

           

          BUT I get a 404 on both localhost2:8081/engine and 127.0.0.1:8081/engine.

           

          if I add default-web-module="engine.war" on both servers hosts, this is even making a 404 on the default server.

           

          So what is wrong here ?

          BR