2 Replies Latest reply on Jul 18, 2014 6:32 AM by Russell Nile

    Redirect root context in Wildfly 8.1.0

    Russell Nile Newbie

      I am using Wildfly 8.1.0 and trying to effectively disable the root context and, ideally, have it re-direct to my application and web page.  So:

           http://server.com/

      gets re-directed to

           https://server.com/myapplication/myapp.html

       

      I added the re-direct to https as well, but if we re-direct to the non-secure port the CONFIDENTIAL should re-direct to SSL for me.

       

      "enable-welcome-root" appears to be obsolete with the change to undertow...although that would only disable root I think.

       

      I looked at the undertow handlers as one is set to handle-up the files found in "${jboss.home.dir}/welcome-content", but ideally I just have that re-cirect to my application (nop, just changing this value does ot work as it is looking for a local directory).

       

      Any ideas?

        • 1. Re: Redirect root context in Wildfly 8.1.0
          Bradley Snyder Newbie

          1. Create a new directory in your JBoss directory. Your original was named "welcome-content", so let's name the new one "root-app-redirect".

           

          2. Create a new index.html file that looks like this:

           

              

           

          3. Create a new handler in your undertow system such that you see this:

          <handlers>
               <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
               <file name="new-welcome-content" path="${jboss.home.dir}/root-app-redirect"/>
          </handlers>
          
          
          

           

          4. Point the root location to the new file handler:

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

           

          The root "/" should now go to your new directory's index.html, which immediately redirects to the content URL.

           

          Edit: the HTML highlighting doesn't seem to be working. Here's what I tried to insert for index.html:

           

          <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

           

          <html>

          <head>

               <meta http-equiv="refresh" content="N;url=https://server.com/myapplication/myapp.html"> <!-- the https should make sure you always get redirected -->

          </head>

          </html>

          • 2. Re: Redirect root context in Wildfly 8.1.0
            Russell Nile Newbie

            You know, now that I see this answer it makes complete sense.  I probably should have thought of that.  I was just going to modify the welcome-content/index.html but didn't like the fact that I had to modify something "out of the box" that way.

             

            I'm going to try to make the change via CLI as well (which I should be able to do).

             

            Thank you!!!

            1 of 1 people found this helpful