4 Replies Latest reply on Jul 16, 2019 3:16 AM by marjinal1st

    Is there a way to dynamically forward wildfly main page to deployed application?

    d47im5e

      Hello everyone,

      Is there a way to dynamically forward main wildfly web page ( when accessing with localhost:8080 ) to dynamically forward to the deployed application ( when i enter the url localhost:8080, i want wildfly to forward this page to my deployed application, meaning it will automatically redirect to localhost:8080/myApp  ) it is starting to bug me on my dev enviroment.

       

      Any advice would be much appreciated.

      Thank you.

        • 1. Re: Is there a way to dynamically forward wildfly main page to deployed application?
          jaikiran

          You can deploy your web application to "root" context. That way it's available at ip:port/

           

          To do that you will have to include a jboss-web.xml and specify the context as "/", if you are deploying the application as a .war file. However, if you are deploying it as a .ear, you can just use the (portable) application.xml and for the "web-app" module specify the context there as "/". I don't have ready examples, right now, to show how it's done, but it should be relatively easy to find such examples online.

          1 of 1 people found this helpful
          • 2. Re: Is there a way to dynamically forward wildfly main page to deployed application?
            marjinal1st

            You can create an exploded ROOT artifact containing an index.html file, which contains meta tag redirecting to whatever URL you like.

             

            Steps to follow (assuming you're deploying to standalone):

             

            1. Create a folder named ROOT.war in standalone/deployments.
            2. Create empty index.html and ROOT.war.dodeploy files in that folder.
            3. Create a basic HTML structure in index.html like this:

             

            <html>

                <head>

                    <meta http-equiv="refresh" content="0;url=http://localhost:8080/myApp" />

                </head>

            </html>

             

            Whenever you visit http://localhost:8080, index.html will refresh the page and redirect to the URL you pointed. If you'd like to add some delay, for example 3 seconds, change value 0 to 3.

            1 of 1 people found this helpful
            • 3. Re: Is there a way to dynamically forward wildfly main page to deployed application?
              d47im5e

              Thank you for your kind responses, i will try them on seperately. I couldn't put the words on the post exactly i wanted, but the suggestions are valid for me. To simplify my question, i will try to describe my wishes in my dev enviroment below,

              I have two seperate projects(war), which can use the same wildfly in my dev env. What i wish is, when i deploy one of these projects, i wish wildfly to get deployed application's root context (i.e. /myapp for one, /app2 for the other ) and if one is deployed, it should automatically forward itself to the deployed app(localhost:8080/myapp or localhost:8080/app2).

               

              Is this possible?

              Thank you.

              • 4. Re: Is there a way to dynamically forward wildfly main page to deployed application?
                marjinal1st

                d47im5e  wrote:

                ... i wish wildfly to get deployed application's root context (i.e. /myapp for one, /app2 for the other ) and if one is deployed, it should automatically forward itself to the deployed app(localhost:8080/myapp or localhost:8080/app2).

                Well, I think that kind of deployment logic is way too redundant and AFAIK (correct me if I'm wrong) it's not possible. If you really like to do it, it may require you to dive into Wildfly (source code level) internals, which I wouldn't recommend it at all.