4 Replies Latest reply on Mar 5, 2015 1:18 PM by Nico Nico

    still redirect to Wildfly home page

    Nico Nico Newbie

      Hi all,

       

      I'm using wildfly 8.2.0 and I'm trying to redirect the "/" to app1

       

      To do that I saw I need to add in my WEB-INF the jboss-web.xml

      like this:

      <?xml version="1.0" encoding="UTF-8"?>

      <jboss-web>

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

      </jboss-web>

       

      I can see in wildlfy log that the context of app1 is "/"

       

      it's working I'm automatically redirect to app1 for:

      http://company.com

      http://company.com:8080/

      http://x.y.z.a:8080/

      http://x.y.z.a/

      http://www.company.com:8080/

       

      But when I try

      http://www.company.com/

      I'm redirect to my wildfly home page

       

      I can add I'm on EC2 and I have done an  port forward to access to my app from 8080 and 80 (because AMZ lock the port 80)

      sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8080

       

      I don't understand why the address www is still not redirect to app1 (and why it's working for www.company.com:8080)

       

      I miss something in wildfly or it's my server config.

       

      Thanks you for your help.

       

      Regards,

        • 1. Re: still redirect to Wildfly home page
          Tomaz Cerar Master

          what does undertow subsystem configuration look like?

          1 of 1 people found this helpful
          • 2. Re: still redirect to Wildfly home page
            Nico Nico Newbie

            Hi Tom,

             

            my undertow looks :

             

            <subsystem xmlns="urn:jboss:domain:undertow:1.2">

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

                        <servlet-container name="default">

                            <jsp-config/>

                            <websockets/>

                        </servlet-container>

                        <handlers>

                            <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>

                        </handlers>

                        <filters>

                            <response-header name="server-header" header-name="Server" header-value="WildFly/8"/>

                            <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>

                        </filters>

                    </subsystem>

             

             


            • 3. Re: still redirect to Wildfly home page
              Nico Nico Newbie

              I tried to remove the handler welcome-content

              So my undertow looks:

               

              <subsystem xmlns="urn:jboss:domain:undertow:1.2">

                          <buffer-cache name="default"/>

                          <server name="default-server">

                              <http-listener name="default" socket-binding="http"/>

                              <host name="default-host" alias="localhost">

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

                                  <filter-ref name="x-powered-by-header"/>

                              </host>

                          </server>

                          <servlet-container name="default">

                              <jsp-config/>

                              <websockets/>

                          </servlet-container>

                          <filters>

                              <response-header name="server-header" header-name="Server" header-value="WildFly/8"/>

                              <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>

                          </filters>

                      </subsystem>

               

              Same issue still redirect to wildfly home page...

               

              Thanks

              • 4. Re: still redirect to Wildfly home page
                Nico Nico Newbie

                it's working

                with the second undertow

                Thank Tomaz for your good comment it help me !